Hi !

I don't know if this is normal, but I can tell you for sure that
setTotalWidth() will never be used to set absolute widths. If you look
at the code (v1.01, PdfDocument.add(Element) ), here is what's
happening when you finally add your table to the doc :

float totalWidth = (indentRight() - indentLeft()) *
ptable.getWidthPercentage() / 100;
(... blah blah blah ...)
ptable.setTotalWidth(totalWidth);

As you can see, the table's totalWidth is calculated from its width
percentage only, and doesn't care about the value you tried to set
before... Moreover, the setTotalWidth method calls the private
calculateWidths() method, which re-calculates the absolute widths. 

Personally, I always call the setWidthPercentage() method, and I
calculate the widths that will fit perfectly in the table (i.e. if I
know my total width is 520, I'll call my setTotalWidth() method with
{200,150,170} ).

Isabelle

----
From: Trevor Linton <trevor <at> verite.com>
Subject: Problems with PdfPTable absolte and relative width
Newsgroups: gmane.comp.java.lib.itext.general
Date: Fri, 05 Dec 2003 15:37:54 +0000

I'm having difficulties where I use PdfPTable.setTotalWidth(float[]) to
set the absolute width of all the cells in a table.  I use this right
after I create my object before any cells are added.  However it
doesn't apply the absolute width's to the cells, it simply sets the
table width to ~~550 pixels then sets all of the cells inside relative
to their values in teh float array, how can I get absolute widths on my
PdfPCell's ?
 
- Trevor
 
Trevor Linton
Senior Web Applications Developer
V�rit� Multimedia
http://www.verite.com
DVD * CD * Web * Print * Film * Sound


____________________________________________________________________________________
Do You Yahoo!? -- Avec Yahoo! soyez au coeur de la r�colte de dons pour le T�l�thon.
http://fr.promotions.yahoo.com/caritatif/


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to