This is a migrated thread and some comments may be shown as answers.

Multiline text in tables gives a wrong result in the Measure() function.

1 Answer 39 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Giorgio asked on 28 Mar 2017, 09:57 AM


I'm creating a PDF document using the FixedContentEditor class. In this document, I've to put a lot of tables and I use the Measure() function to read the height of the last table inserted in order to move the current position (with editor.Position.Translate) and to start with a new table.

Unfortunately, I noticed that this works fine but if the table has multi rows texts in cells, the Measure function gives me the result as the cells had only singles row texts in the cells.

To add a cell with multi rows text I use the following code:

TableRow row = table.Rows.AddTableRow();
TableCell cell = row.Cells.AddTableCell();
Block block = cell.Blocks.AddBlock();
block.InsertText(font, FontStyles.Normal, FontWeights.Bold, "Details:");
cell = row.Cells.AddTableCell();
block = cell.Blocks.AddBlock();
foreach (string line in multirows_text.Split('\n'))
  block.InsertText(fontFamily, fontStyle, fontWeight, line);


Then, I use the following code to get the table height:


that gives me the same value both if the multirows_text string variable contains one or more lines of text

Is there another way to get the table height in case of tables with multiple lines of text cells?

Any help will be appreciated. Thanks in advance.


1 Answer, 1 is accepted

Sort by
Martin Ivanov
Telerik team
answered on 31 Mar 2017, 08:57 AM
Hello Giorgio,

I tested your code and the Measure() method seems to return the correct size. Can you check the attached project and let me know if I am missing something?

Telerik by Progress

Asked by
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question