Abhishek Sinha wrote:
> where I saw Split Table example. I
> tried this example for my problem but when I have more rows (data) it
> doesn't split the table automatically to another page. I can explicitly
> mention the number of columns on one page but it is difficult to mention the
> number of rows per page. 
> 
> table.writeSelectedRows(0, 5, 0, -1, 50, 650, cb);

If you have read the tutorial about tables or chapter 6 in the book, you 
KNOW that writeSelectedRows doesn't split rows automatically. That's 
normal, so I'm going to ignore all the above.

> Number of rows (data) per page depends upon the content in the cell. If the
> content is large (like comments or remarks columns) then 4-5 rows can only
> fit on one page, if content is small 7-8 rows can fit on one page.
> 
> Can anyone suggest me some approach or any sample code to implement this
> requirement.

There is only automatic table splitting if you use documetn.add(table);
The reason why you probably can't use this, is because you also need to 
split the table vertically (not only split between rows, but also 
between columns).

In that case, you can't use anything else than writeSelectedRows and you 
are responsible for the "position management" yourself.

It's just some math, isn't it? You can calculate the height of each cell 
and decide how many cells fit on one page. You add those rows using 
writeSelectedRows with the correct rowcount instead of using "-1" as a 
parameter. The method also returns the Y value indicating were the 
bottom bottom was drawn; so you could draw one row at a time and decide 
on a row per row basis if you want to.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
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