I would like to set a left indent of an inner table. To set the left indent of
an outer table I put this table into a Paragraph and set the left indent of
this paragraph. This works fine. My problem is, that this use case doesn't
work with inner tables. If I put an inner table into a Paragraph and add this
Paragraph into a PdfPCell, the table will disappear in the created document.
Any ideas how I could implement an inner table with a left indent?
Code example:
document.open();
//create two paragraph objects with a left indent of 30 points
Paragraph paragraphA = new Paragraph();
paragraphA.setIndentationLeft(30);
Paragraph paragraphB = new Paragraph();
paragraphB.setIndentationLeft(30);
//create inner table
float[] width = {50,50};
PdfPTable innertable = new PdfPTable(width);
PdfPCell innercell = new PdfPCell(new Phrase("Test1.1"));
PdfPCell innercell2 = new PdfPCell(new Phrase("Test2.2"));
innertable.addCell(innercell);
innertable.addCell(innercell2);
//add inner table into paragraphB
paragraphB.add(innertable);
//create outer table
PdfPTable table = new PdfPTable(width);
PdfPCell cell = new PdfPCell(new Phrase("Test1"));
PdfPCell cell2 = new PdfPCell(new Phrase("Test2"));
table.addCell(cell);
//add paragraphB into the table cell
cell2.addElement(paragraphB);
table.addCell(cell2);
//add outer table into paragraphA and set a left indent for this paragraph
paragraphA.add(table);
//add paragraph into document
document.add(paragraphA);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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/