You'll probably need PdfPTable to do such measurements.

Best Regards,
Paulo Soares

----- Original Message ----- 
From: "Janarthan S" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, July 24, 2003 16:00
Subject: Height of table when cell contains a huge text


> 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
> "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".
>  
> 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
> 



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to