On 8/10/2010 10:41, BM wrote: > Hi! > > Why is it the method is called "setWidthPercentage" when it is > actually "setColumnWidthsInPoints"?
That method is named setWidthPercentage(), because you can use it to define the width as a percentage of the available space. If you want to define the width in points, you should use setTotalWidth(). Each PdfPTable stores these two values, but the actual value that will be used depends on what you do with the table. If you add the table with writeSelectedRows(), the width percentage will be ignored. If you add the table with Document.add(), iText will look at the value of lockedWidth. If lockedWidth is true, the "total width" will be used. If false, the width percentage will be used. > E.g., when you divide page size per amount of columns, then you will > get one column width. ??? > So then if you put them into an array and set it > like "table.setWidthPercentage(colwidths, doc.getPageSize())", then it > is the same as "table.setWidthPercentage(100)". > > As long as I am not missing something, this is confusing. Your question confuses me. Section 4.1.2 of the second edition of "iText in Action" lists every possible way to set the widths of the complete table and its columns. Please clarify what isn't clear in section 4.1.2. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php