If I construct a Paragraph that contains a table, and then add the
paragraph to a table using addCell, the table does not appear.
It seems that PdfTable.addCell(Phrase phrase) does not work properly
- since a Paragraph is a Phrase by inheritance.
Is this a known problem? Is there some other way of doing this? The
html may be arbitrary.
sample code:
...
String html = "text<table><tr><td>a table</td></tr></table>";
Paragraph paragraph = toParagraph(html);
PdfXTable tbl = new PdfXTable(1);
tbl.addCell(paragraph);
doc.add(tbl);
...
The toParagraph() is:
protected Paragraph toParagraph(String html) throws IOException {
List list = HTMLWorker.parseToList(new StringReader(html), new
StyleSheet());
Paragraph p = new Paragraph();
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Element element = (Element) iterator.next();
p.add(element);
}
return p;
}
-------------------------------------------------------------------------
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/