Force row/cell to fill space in header with RadFlowDocument

0 Answers 19 Views
Top achievements
Rank 1
Jeff asked on 14 Sep 2022, 03:13 PM | edited on 14 Sep 2022, 05:02 PM


Using a RadFlowDocument, I must generate dynamic headers for columns of data. There is no template or way to know ahead of time what headers are needed, so we have to recursively extract data and render tables/rows within outer cells, to align the data w/ the proper column. Overall this works fine. However, tables do not, as far as I can tell, stretch to fit the space their cells, so I'm left with these gaps (in blue in first attached image), as the overall height of the main header row is set by the column with the largest/tallest data, in this case the group of columns with the red borders. 

Is there any way to get the inner tables to stretch to fill that available height?

Note: The different color backgrounds and borders in attached image are for debugging purposes

The general structure of Cells/Rows/Tables that I end up with following this recursive build is described in the second attached image. Rows are red, cells are green, and tables are blue. Perhaps there is another way to build the header that I am not considering. 

Thank you

Edit: I solved the problem changing tactics. I queried the list of headers for a maximum depth and created that number of rows. Added the rows to a list and passed the list to the recursive function. Instead of creating a new table for each subcategory, the code now just adds the item to the proper row, index based on the item's depth, and with proper RowSpan and ColumnSpan values, I'm able to get the desired placement. Image added for comparison. 

Telerik team
commented on 19 Sep 2022, 09:23 AM

Hi Jeff,

Your solution to the problem sounds good. What I can see as a downside is that, if some of the text on one row flows down and wraps, it will lead to the initial case with the gaps.

Another idea that I might propose is to edit the header row. What I have in mind is to make the row with the maximum columns and rows needed there and then merge the cells vertically and/or horizontally. This will remove the presence of nested tables. Even though this approach will be universal it will also demand much more effort to implement.

As a side note: tables do not auto-stretch vertically to fill the available space. They can only be resized if needed. This is the expected behavior and can be observed in Word.

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question