Ok, looking back I may not have been clear enough.  I need to split the table 
vertically (like figure 6.10 in the book)

I have 20 columns, with a total column width of 1000 pts

I am writing out to standard Letter size (Landscape orientation) paper with a 
total width (forget about margins for now) of (11 inches x 72 points) 792 
points.

It seems to me (from the examples I am looking at and samples I have found) if 
the total column width is larger than the page width I have 3 options.
1) use setWidthPercentage to 100 to squeeze everything into 1 page (which can 
makes things unreadable)
2) use SetTotalWidth(float[]) to set the total width, which causes the text to 
run off the right side of the page
3) use WriteSelectedRows to write N columns out to page one and the remaining 
columns out to page two (as in figure 6.10 in the book)

Document.add just adds the whole table (resulting in 1 or 2 above).

-----Original Message-----
From: 1T3XT info [mailto:[email protected]] 
Sent: Wednesday, April 15, 2009 4:21 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Building a pdf with tables that break across 
multiple pages

Erik Pfingsten wrote:
> I would like to simulate something like SQL Reporting services 
> where they will get repeating headers on each page, as well as having 
> long rows break across pages (ie when they select 50 fields and the data 
> is say 500 rows of data, the first 10 fields/first 30 rows show on page 
> 1, the next 10 fields/first 30 rows show on page 2, etc through page 5, 
> then the next set of rows 31-60 appears on page 6, etc.

That's done automatically, isn't it? See http://1t3xt.be/?X00002a


> My general approach that I am thinking of taking is as follows:
> Set up a table with the 50 columns
> calculate approximate column widths by using getWidthPoint on the text 
> in each column of the first row of data

You need to know the column widths in advance; so yes, you probably need 
getWidthPoint to achieve this.

> use the columns widths to do SetTotalWidth
> add my cells to the table
> use PdfPTable.Size to get the number of rows in the table, then divide 
> that by how many rows I think will fit on a page

I don't think that's necessary, unless you

> use WriteSelectedRows(colStart, colEnd, rowStart, rowEnd, xPos, yPos, 
> canvas) to write out x number of columns and n number of rows then do a 
> new page and use WriteSelectedRows with the next batch of columns, do a 
> new page, next set of columns, etc.

I don't understand why you would need WriteSelectedRows.
Why don't you add the table to the document?

If you need to add the table at absolute positions, wrap
it in a ColumnText object like this: http://1t3xt.be/?X0000a4

> Does this makes sense?  In general is this the "correct" way to go about 
> accomplishing what I need or am I going down a completely wrong path?

I think you're making it yourself difficult by using writeSelectedRows.
It's easier to just add the table to the document. That also allows you
to tune the way the content inside the cells is split:
http://1t3xt.be/?X000041

> Also, I have ordered the book and it should be arriving tomorrow, so if 
> the answer is "this exact situation is described in detail in the book, 
> go buy it", I can live with that too

You'll recognize the examples mentioned above in chapter 6 of the book ;-)
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
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


This message, including any attachments, may contain information
which is confidential and privileged. Unless you are the addressee (or 
authorized to receive for the addressee), you may not read, use, copy 
or disclose to anyone the message, its attachments, or any information 
contained therein. If you have received the message in error, please 
advise the sender by reply e-mail and delete the message and any 
attachments.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
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

Reply via email to