Put the table inside a ColumnText and the split will be taken care.

Paulo

----- Original Message ----- 
From: "Remya Srinivasan" <[email protected]>
To: <[email protected]>
Sent: Monday, August 03, 2009 10:56 AM
Subject: [iText-questions] How to use splitRow()?


Hello,

The PDFs that I am generating have large header and footers (consisting of 
multiple PdfPTables). The code to render them is included in onEndPage.

Between the header and footer, I need to include a PdfPTable which runs to 
several pages. I have used writeSelectedRows() to display the rows of the 
table carefully, so that they don't run over the footer. The height of each 
row may vary depending on the size of the data fetched from the database.

This works fine when the rows have almost the same heights. But a lot of 
empty space is seen before the footer, when the height of the last row being 
displayed on a page is greater than the available height, and it has to move 
to the next page.

I would like to split a row for the following reasons:

1. To get rid of the extra empty space before the footer.

2. In case the height of a single row itself is greater than the available 
height between the header and footer.

I have tried to use

row=table.getRow(i);
PdfPRow splitRow=row.splitRow(table,i,availaleHt);

and

splitRow.writeCells(0, -1, d.leftMargin(), yPos, canvases);

where,
table is the PdfPTable that is being displayed between the header and footer
i iterates through each each row of the PdfPTable (till table.size())
availableHt is the height between the last rendered row and footer.

This approach doesn't seem to work. Please guide me on how to split a row 
(multiple times if required).
Also, as per the documentation, splitRow returns the remainder row.

1. How do we capture and print the first half of the row?

2. And writeCells takes a PdfContentByte[] argument (canvases). How to 
generate canvases?

Thank you,
Remya



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to