Condividi tramite


CanShrink does not work with RDLC when the textbox is within a data control like Table / Matrix

ISSUE: 

As per definition, https://msdn.microsoft.com/en-us/library/ms251779.aspx

Growing and Shrinking a Text Box
By default, text boxes are a static size. If you want to expand a text box vertically based on its contents, change the CanGrow property for the text box. If you want to allow the text box to shrink based on its contents, change the CanShrink property for the text box. You can access these properties through the Properties window or through the Textbox Properties dialog box.

But when you place the textbox within a data control like TABLE / MATRIX, the CanShrink property is never honored. At the same time the CanGrow property will always work as expected.

EXPLANATION:

This is "By Design" behavior. The table row/column will not shrink below its definition height/width. This is in order to mitigate performance and memory concerns. Also the impact should be minimal, since we allow the row to grow.

You start with a small height for the table row and let it to grow to accommodate the content.

Comments

  • Anonymous
    October 09, 2008
    PingBack from http://www.easycoded.com/canshrink-does-not-work-with-rdlc-when-the-textbox-is-within-a-data-control-like-table-matrix/

  • Anonymous
    June 09, 2009
    You workaround still does not work. As it grows all the time, even if you set row height to 0.05. Empty rows still appear at a larger height. The other problem with that is you can't see what is on the report in Designer, you would need to resize it all the time, the context is not oblivious right away. So I think your "by design" is as usual done in Microsoftish way which would not accomodate real world scenarios. Why didn't you guys just use Access report designer, which is way better. Everybody I know that says Access reports are better.

  • Anonymous
    August 06, 2009
    The comment has been removed

  • Anonymous
    April 22, 2010
    Excellent comments gentlemen.....especially "You start with  a small height for the table row and let it to grow to accommodate the content" !!!!!!! you really great

  • Anonymous
    November 10, 2010
    I have an issue with this as my text can be very long. and therefore I don't want to enable Cangrow ( and lose some forests) I wanted to set the field to about 5 rows 2cm and then allow can shrink..... if this is the design can we have 1 the canshrink greyed out 2 a Maximum size property

  • Anonymous
    November 11, 2010
    I'm not able to understand your question. Could you please brief this a little more and explain it clearly what you're trying to achieve?