Hi,

 

I have a couple of questions regarding column widths in a PdfPTable.

 

1) Is there a quick, out-of-the-box way to "tell" the table to set each
column width to the width of the cell (among the cells in the column)
with the maximum width?

 

2) If not, what's the best approach that you could recommend to do that?
I have a document that contains a number of tables that are added one
after another. The data and the metadata in each table vary at runtime
(depending on the data type and the actual data the table represents).
There are header rows which span multiple columns. What I see is that
each column gets an even percent of the width of the table regardless of
the data that it wraps. One approach that I tried but did not work (keep
in mind that I've only been using iText for 2 days before trying to kill
me) is keeping track of the width of the data of each cell in a given
column, using ColumnText.getWidth(Phrase p) - p being used when
constructing the PdfPCell-s; and at the end doing a table.setWidths with
the max width of each column.

 

I apologize if this has already been addressed in a previous post, but a
search and a quick scan did not find me a match.

 

Thanks, -nik

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to