dynamic - Getting table height dynamically in iText -
Is there a way to get the height of the table before adding it to the document?
At first glance, I think the number of rows in the table is enough to calculate the height because I know the size of the font. However, some lines broke that rule. For example, a cell can store a paragraph that contains more than one row. Therefore, what I should know, is the total number of heights of each row.
Yes, the answer was not complex.
To get the height of the table, first the width of the table must first be set. In other words,
table.setTotalWidth ((PageSize.A4.getWidth () - document.leftMargin () - document.rightMargin ()) * table.getWidthPercentage () / 100); Println (table.calculateHeights ()); Gives the height of the table.
Comments
Post a Comment