I have just taken use of iText and come across a problem with my table.
Column one in the table is a fixed string size which I know, but column two
has a variable string size according to user input.
What I need is to automatically adjust the second columns width according to
the string size.
The code I have now is something like this.
float[] widths2 = { 0.8f, 1.1f };
PdfPTable table2 = new PdfPTable(widths2);
table2.setSpacingBefore(10f);
table2.setSpacingAfter(10f);
table2.setWidthPercentage(55);
table2.getDefaultCell().setBorderWidth(1f);
With width 1.1f and table width in percentages 55% is just enough to display
my table centered with a string consisting of 12 chars.
How could I set the setWidthPercentage and cellwidth according to the string
size?
The reason I want this is to be able to keep the table width minimal and
center it on the page.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/