Mitch Freed wrote:
I had and it doesn't.

You're not trying hard enough.

You can't add a PdfPTable to ListItem()

My attachment proves the opposite.

but you can add it to the List class.

That's not done.

br,
Bruno

Attachment: table_in_list.pdf
Description: Adobe PDF document

package test;

import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.List;
import com.lowagie.text.ListItem;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;

public class TableInList {

        public static void main(String[] args) {
                Document document = new Document();
                try {
                        // step 2:
                        // we create a writer
                        PdfWriter.getInstance(
                        // that listens to the document
                                        document,
                                        // and directs a PDF-stream to a file
                                        new 
FileOutputStream("table_in_list.pdf"));
                        // step 3: we open the document
                        document.open();
                        // step 4: we add a paragraph to the document
                        PdfPTable table = new PdfPTable(2);
                        table.addCell("hello");
                        table.addCell("world");
                        List list = new List();
                        ListItem item;
                        item = new ListItem("Hello World");
                        list.add(item);
                        item = new ListItem();
                        item.add(table);
                        list.add(item);
                        item = new ListItem("with table:");
                        item.add(table);
                        list.add(item);
                        item = new ListItem("without table");
                        list.add(item);
                        document.add(list);
                } catch (DocumentException de) {
                        de.printStackTrace();
                        System.err.println(de.getMessage());
                } catch (IOException ioe) {
                        ioe.printStackTrace();
                        System.err.println(ioe.getMessage());
                }

                // step 5: we close the document
                document.close();
        }
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to