No I haven't.  Does this work if you have not yet added the table to the
document?  I need to determine all of this before the table is inserted.  I
will look into it.

Thanks.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Carmona
Perez, David
Sent: Tuesday, September 23, 2003 1:59 AM
To: [EMAIL PROTECTED]
Subject: RE: [iText-questions] PdfPCell/Table Width {Scanned}


Have you tried using table events to determine the real table size?


--------
David

-----Mensaje original-----
De: Bill Simpson [mailto:[EMAIL PROTECTED]
Enviado el: martes, 23 de septiembre de 2003 2:07
Para: [EMAIL PROTECTED]
Asunto: [iText-questions] PdfPCell/Table Width {Scanned}

I have a PdfPTable which contains nested PdfPTables.  I'd like to be able to
determine the optimal width of the columns for the outer table by running an
algorithm against the widths of the tables that the rows will contain.  I
have already confirmed that I can build my sub-tables before I render the
outer table.  Is there a way to determine the width of the sub tables before
I actually put them into the document?

Here is what I tried:
// Calculate relative widths of each table.  We'll use this then to
// determine the widths of the rows of the outer table.
float width1 = statsTable1.getTotalWidth() ;
float width2 = statsTable2.getTotalWidth();
float width3 = statsInfoTable.getTotalWidth() ;
float width4 = specInfoTable.getTotalWidth() ;
float totalWidth = width1 + width2 + width3 + width4 ;

float colWidths[] = new float[4] ;
colWidths[0] = width1 / totalWidth ;
colWidths[1] = width2 / totalWidth ;
colWidths[2] = width3 / totalWidth ;
colWidths[3] = width4 / totalWidth ;

// Outer Table
PdfPTable outerTable = new PdfPTable ( colWidths ) ;
outerTable.setWidthPercentage(100f);

Note - the four tables used to make up the cells allow the document to
determine their optimal widths; I do not set them in advance.

When I run the above code, I get a size of 0 for each of the tables (which
will ultimately lead to a divide by 0 error).  Is this the proper way to
determine the sizing?  If not, what is it?

Any help is appreciated.

Bill



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to