Hi ,
I am few weeks old to iText. I am using ColumnText to split a PdfPTable if
it doesnt fit on page. 
if table is split, then both the portions of the table should have header to
it.
i tried using 
table.setHeaderRows(2);
table.setFooterRows(1);, But result was not as expected(May i missed some
thing in using these methods).
Thought i would use columnText as it was said in lot many posts.
Problem i am facing is: if i say column.go() , it doesn't write the content
on document.
I dont know what is missing in my code. Is there any property of columnText
needs to be set before using Go() method so that it will write content on to
Document.
my code goes below. 

private void generatepdfReport() {
PdfPTable = createPdfPTable(); // This will create my Table and add
PdfPCells to Table.
ColumnText column = new ColumnText(pdfWriter.getDirectContent());
column.setSimpleColumn(pdfDocument.top(), pdfDocument.left(),
pdfDocument.right(),pdfDocument.bottom());
column.setYLine(pdfDocument.top());
int status = column.START_COLUMN;
status = column.go();
if(ColumnText.hasMoreText(status)) {
pdfDocument.newPage();
column.setYLine(pdfDocument.top());
preparepdfReport(planList, column, status, fundTable, pdfWriter,
instituteName);
}
}

private void preparepdfReport(List planList, ColumnText column, int status,
PdfPTable table, PdfWriter pdfWriter, String instituteName) throws Exception
{

//this will add header to the table on New Page.                
                PdfPTable headers = createPdfPTable(5, PdfPTable.ALIGN_LEFT, 
100f, 6,
Rectangle.NO_BORDER);
                headers.addCell( createPdfPCell( instituteName, 
                                        12, PdfPCell.NO_BORDER, 6, false) );
                headers.addCell( createPdfPCell("", 9, PdfPCell.NO_BORDER, 6, 
false) );
                
                headers.addCell( createPdfPCell( planList.getPlanName() +  
                                ReportProperties.getProperty("CURRENT_TOTAL") + 
DOLLAR +
                                retirementPlan.getPlanAssetValue(), 10,
                                                   PdfPCell.NO_BORDER,
6,true) );
                headers.addCell( createPdfPCell("", 7, PdfPCell.NO_BORDER, 6, 
false) );

                headers.addCell( createPdfPCell("",PdfPCell.NO_BORDER, 2) );
                headers.addCell(
createPdfPCell(ReportProperties.getProperty("REALLOCATE_EXISTING"), 7,
PdfPCell.NO_BORDER, 2, false) );
                headers.addCell(
createPdfPCell(ReportProperties.getProperty("INVEST_NEW"), 7,
PdfPCell.NO_BORDER, 2, false) );
                headers.addCell( 
createPdfPCell(ReportProperties.getProperty("FUND_NAME"),
8, PdfPCell.NO_BORDER, 2, false) );
                headers.addCell( 
createPdfPCell(ReportProperties.getProperty("CURRENT"),
8, false) );
                headers.addCell( 
createPdfPCell(ReportProperties.getProperty("CHANGE_TO"),
8, false) );
                headers.addCell( 
createPdfPCell(ReportProperties.getProperty("CHANGE_TO"),
8, false) );

                pdfDocument.add(headers);

// This will add remaining content in columnText to Page.
                column.setYLine(createPdfPCell("",PdfPCell.NO_BORDER, 
2).getHeight()*3);
                status = column.go();
                if(column.hasMoreText(status)) {
                        pdfDocument.newPage();
                        column.setYLine(pdfDocument.top());
                        preparepdfReport(listPlan, column, status, table, 
pdfWriter,
instituteName);                 
                }
                
        }

-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Problem-using-ColumnText-tp3080200p3080200.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:

WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to