Hi,
 I have a table with 2(or more header rows) and n-Data rows.
The table will have 10 columns.
In the first header row, i want to have a column span of 1 for the first 4
columns and a column span of 2 for the next three( 3x2 = 6) columns.
In the second header row and in the data rows i want to have a column span
of 1 for all the columns.

Since PdfPTable doesn't support column span, I am planning to use nested
tables as shown below:
Let me know if this is the efficient way of doing nested tables:

//////////Sample Code/////////////////
PdfPTable mainTable = new PdfPTable(1);
PdfPTable headerTable1 = PdfPTable(7);
float widthPercents1[] = { 1, 1, 1, 1, 2, 2, 2 };
headerTable1.setWidths( widthPercents );

PdfPTable headerTable2 = PdfPTable(10);
float widthPercents2[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
headerTable2.setWidths( widthPercents2 );

mainTable.addCell( headerTable1 );
mainTable.addCell( headerTable2 );
mainTable.setHeaderRows(2);

PdfPTable dataTable = new PdfPTable(10);
dataTable.setWidths( widthPercents2 );
for(int i = 0; i < 200; i++) {
        for(int j=0; j < 10; j++) {
                dataTable.addCell( "Data");
        }
        mainTable.addCell( dataTable );
         dataTable.deleteLastRow();
}

document.add( mainTable );
////////////End Sample Code////////////

Thanks,
Vasu


_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to