|
Hi All,
I am using nested Table for displaying various kinds of data. In the nested table first table is header table which defines column names. So when it goes to new page nested page should call Header table after it should continue from other table where it was broken. Here is my code.But it doen't seems to work.
PdfPTable maintable = new PdfPTable(1); maintable.setHeaderRows(1);
PdfPTable headerTable = getHeaderTable(); maintable.addCell(headerTable);
PdfPTable donTable = getDonTable(nurseExpenses); maintable.addCell(donTable);
PdfPCell cell = new PdfPCell(new Phrase(" "));; maintable.addCell(cell);
PdfPTable rnTable = getRNTable(nurseExpenses); maintable.addCell(rnTable);
cell = new PdfPCell(new Phrase(" "));; maintable.addCell(cell);
PdfPTable cnaTable = getCNATable(nurseExpenses); maintable.addCell(cnaTable);
if (!writer.fitsPage(maintable)) { System.out.println("Inside fit table"); maintable.deleteLastRow(); maintable.writeSelectedRows(0, -1, document.left(), document.getPageSize().height(), cb); document.newPage(); maintable = new PdfPTable(1); maintable.getDefaultCell().setPadding(2); maintable.setTotalWidth(100); maintable.getDefaultCell().setBorder(Rectangle.NO_BORDER); maintable.getDefaultCell().setBorderColor(Color.white); maintable.setHeaderRows(1); maintable.addCell(headerTable);
maintable.addCell(cnaTable); }
cell = new PdfPCell(new Phrase(" "));; maintable.addCell(cell); PdfPTable rnpsTable = getRNPSTable(nurseExpenses); maintable.addCell(rnpsTable);
cell = new PdfPCell(new Phrase(" "));; maintable.addCell(cell); PdfPTable lpnpsTable = getLPNPSTable(nurseExpenses); maintable.addCell(lpnpsTable);
maintable.writeSelectedRows(0, -1, document.left(), document.getPageSize().height(), cb);
Thankyou very much Paulo for the response.I using pdfptable as suggested by you. But it doesn't work. It is truncating some of data. Actually PDF should come in two or three pages with header table in each page and keep continuing from broken table.
Can anyone please suggest me. Thanks, Suneetha
|
- Re: [iText-questions] how to add a headertable on... Kurakula, Suneetha (HCF)
- Re: [iText-questions] how to add a headertab... Paulo Soares
