Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PdfPTable

 
Chris Lonie
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bruno,

We are using iText and very happy with it. The one area that I have not come up with a good answer is for our table of addresses. We are using PdfPTables. The table is 2 columns wide by 3 rows high. Each cell also contains another PdfPTable. This is done so that the top of each pair of inner tables (of each row of the outer table) is at the same height on the page. Our problem is that we have to force a new page before beginning the outer table since we have quite a bit of address data, sometimes leaving alot of white space on the previous page. Is there a better way of doing this instead of the nested tables?

Thanks,
Chris
 
Bruno Lowagie
author
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Lonie:
Is there a better way of doing this instead of the nested tables?


You have something like this:

+-------+-------+
| table | table |
+-------+-------+
| table | table |
+-------+-------+
| table | table |
+-------+-------+

Before adding this to the document,
you perform document.newPage().

I assume that you want to split the table.
Question is: (how) do you want to split the table?

Which part of the table do you want on the
current page, and which part should be forwarded.
Do you want to split the table keeping the rows
of the outer table complete (no splitting of the
inner tables), keeping the rows of inner tables
complete (no splitting of inner rows), or can
inner rows be cut in two?

I'll try to provide an example with the different
possibilities soon. There's an example in the book,
but it doesn't involve nested tables.

br,
Bruno
 
Chris Lonie
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bruno,

Yes, the table does look the way you drew it and, yes, we do perform a document.newPage().

I would like to keep the rows of the inner table complete. If it is easier to allow the inner rows be cut in two, then that is also very acceptable.

Thanks,
Chris
 
Bruno Lowagie
author
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Lonie:
I would like to keep the rows of the inner table complete. If it is easier to allow the inner rows be cut in two, then that is also very acceptable.


OK, I've been very busy today.
I'll try to find some time to write you some sample code tomorrow.
 
Chris Lonie
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you - it is very much appreciated.
 
Bruno Lowagie
author
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an example demonstrating how nested tables are split:


[ UD: Broke long line into two, so that the layout doesn't get screwed up. ]
[ November 18, 2006: Message edited by: Ulf Dittmer ]
 
Bruno Lowagie
author
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

UD: Broke long line into two, so that the layout doesn't get screwed up.


Thanks!
I'll put the next code sample (adding a submit button to an existing form) online somewhere, so that people don't have to copy/paste.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic