Here is the description what goes wrong:
First I create a List, add it into the PdfPCell, clear the List, add a
PdfPTable into the PdfPCell, add then two new Paragraph objects into the List
and add the List again into the PdfPCell. The error is, that in the PdfPCell
the two new added Paragraph objects were written in front of the table and not
the content before the two Paragraphs were added.
My Code:
document.open();
List list = new List(List.ORDERED, 20);
list.add(new ListItem(new Paragraph("Test1")));
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100);
PdfPCell cell1 = new PdfPCell();
cell1.addElement(list);
list.getItems().clear();
PdfPTable innerTable = new PdfPTable(1);
innerTable.setSpacingBefore(5);
innerTable.setWidthPercentage(100);
PdfPCell innerCell = new PdfPCell(new Paragraph("InnerCell"));
innerTable.addCell(innerCell);
cell1.addElement(innerTable);
list.add(new ListItem(new Paragraph("Test2")));
list.add(new ListItem(new Paragraph("Test3")));
cell1.addElement(list);
table.addCell(cell1);
document.add(table);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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/