PdfPTable doesn't support using Paragraph as a container for other objects. 
You'll have to use PdfPCell.addElement() for each object.

Paulo

----- Original Message ----- 
From: "robert engels" <[EMAIL PROTECTED]>
To: "iText here itext" <[email protected]>
Sent: Tuesday, June 05, 2007 6:50 PM
Subject: [iText-questions] PdfTable.addCell(Phrase) broken?


> 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/

Reply via email to