Use a PdfPTable.

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, July 28, 2005 1:09 PM
Subject: [iText-questions] problem with tables and wrap


Hi everyone,

In my project i encountered a problem with tables that wrap around a page.
If I render another table on the next page the header text and the header
border lines are not synchron (see the attached example).
Here is the source code, that produces the example:


Document pReportDoc = new Document();

try
{
    PdfWriter pWriter = PdfWriter.getInstance(pReportDoc,
                                              new
FileOutputStream("C:\\Test.pdf"));
    pReportDoc.open();

    for(int t = 0; t < 4; t++)
    {
        Table table = new Table(3);
        table.setBorderWidth(0.1f);
        table.setPadding(1);
        table.setSpacing(0.2f);
        table.setCellsFitPage(true);
        table.setOffset(8f);

        Cell cell = new Cell("header1");
        cell.setHeader(true);
        cell.setColspan(1);
        table.addCell(cell);
        cell = new Cell("header2");
        cell.setHeader(true);
        cell.setColspan(1);
        table.addCell(cell);
        cell = new Cell("header3");
        cell.setHeader(true);
        cell.setColspan(1);
        table.addCell(cell);

        table.endHeaders();

        for(int i = 0; i < 20; i++)
        {
            cell = new Cell("left");
            table.addCell(cell);
            cell = new Cell("middle");
            table.addCell(cell);
            cell = new Cell("right");//1\\nright2");
            table.addCell(cell);
        }

        pReportDoc.add(table);
    }
}
catch(Exception e)
{
    int i=0;
}
finally
{
    pReportDoc.close();
}



What am I doing wrong here?

Ciao
matthias

-- 
Matthias Schmidt
sd&m AG



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to