Dynamically added rows not displaying correctly

Posted by: bbeyer on 1 February 2021, 7:09 am EST

  • Posted 1 February 2021, 7:09 am EST

    Hi all,

    TLDR: I need to add an unknown number of rows (like a table) to a report but the Y-axis alignment of them is thrown off when a row grows from wrapped text.

    I have a problem I have tried approaching several different ways with little success. I need to add rows to a report (essentially like rows of a table) based on the number of entries in my model, however, if any of the text boxes have text that wraps, it causes all sorts of problems with future rows being added in the right spot.

    To track the Y location for the next row I have used a variable that adds the height of the previous row every time a row is added to itself and adds the next row at that location, which works unless the row resizes from text wrapping.

    I tried to do it by creating a sub report for each row and adding those to the main report, which works for a little while but if enough rows are added a large gap of whitespace appears between random lines with no noticeable consistency from report to report, despite the fact that the variable tracking the Y location of the next row doesn't show any unusual increases in debug.

    I also tried adding the text boxes and whatnot for each row within the report generation without the use of a sub report but in this situation, the increased height is not registered so the next row starts where it would if the previous row had not grown, causing the wrapped text to overlap.

    I have seem mention of the timing and execution of the Format event and BeforePrint event potentially affecting this, but have not been able to utilize those in any way to solve this.

    Any help would be greatly appreciated!
  • Replied 1 February 2021, 2:32 pm EST


    Can you please confirm that all data coming from the single table or list? Can you bind the report with the datatable and map textbox with the column of the datatable?
    Also, you are taking the height of the previous row in the "BeforePrint" event of the Detail section?

  • Replied 5 February 2021, 3:22 am EST


    Thanks for the tip on using BeforePrint, that worked perfectly! Now my problem is that the details section must also be resized accordingly, but when I do it in BeforePrint, it does change size of details, but the things caused by the original size don't change. For example: if the details section was made larger, the things cut off by it when it was smaller are still cut off and if it was made smaller, the extra pages that were created when it went to a new page are still there and blank. How can I fix this?

  • Replied 7 February 2021, 12:51 am EST


    If you want to change the width of the detail section, then I prefer to change the page size at runtime. And there is no need change the height of the detail section as it automatically grow as per content. Just set the "CanGrow" and "CanShrink" property of detail section set to true.

  • Replied 8 February 2021, 3:57 am EST

    Because the rows are being resized/repositioned in BeforePrint, the detail section's height needs to be increased to fit the table, but it looks like this can't be done in BeforePrint as it doesn't change when I try. Is there a way for me to set the detail height based on the calculated heights of the table rows?
  • Marked as Answer

    Replied 8 February 2021, 8:31 pm EST


    As I said earlier, there is no need change the height of the detail section as it automatically grow or shrink as per content. Just set the "CanGrow" and "CanShrink" property of detail section set to true. Have you tried at these at your end. If you are still facing the issue, please send me the working sample so that I can observe the same at my end and help you accordingly.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels