Hi,
 
I am using itext in my project. It is simply great !!!
 
I have a method that adds cells to a table that gets called in a loop -
 
 private void addToTable(Table vTable, String vText) {
       Chunk mChunk = new Chunk(vText, FontFactory.getFont(FontFactory.COURIER, 20, Font.ITALIC, new Color(255, 0, 0)));
         Cell mCell = new Cell();
         mCell.setBorderColor(Color.WHITE);
         mCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
 
         mCell.add(mChunk);
 
         vTable.addCell(mCell);
 }
 
The table is defined as -
 Table mTable = new Table(1);
 
I am also calculating the height of the table (in int) as -
int mTableHeight = (int) (vTable.getDimension().getHeight()) * (int)(72 / 2.5);
 

The problem occurs, when the String that is passed too long.
For an example String is "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".
 
This String gets wrapped in the cell. I can accept that. But the height of the table remains the same. As the word gets wrapped, it takes more space and more height, but the height as returned by vTable.getDimension().getHeight() remains the same. I think the height depends on number of rows in the table.
Is there any way for calculating the actual (may the text in any cell be any long) height of the table ?
 
Thanks,
Janarthan S

Reply via email to