Looking into it a little more, the code that is supposed to handle keeping the border on top will only work for cells on the same row. There is also a hack in there to keep the table borders from being covered up by backgrounds. So, you're right - this is a bug.

I'll look into fixing this, but for now a workaround may be to use variable borders and border padding. This should keep the cell spaces from overlapping. In your example, change each cell to use something like:

  Cell c = new Cell(new Phrase("0.0"));
  c.setUseVariableBorders(true);
  c.setUseBorderPadding(true);
  c.setBorder(Rectangle.BOX);
  c.setBorderWidth(.2f);
  tbl.addCell(c);

----- Original Message ----- From: "David Perez" <[EMAIL PROTECTED]>
To: "iText" <itext-questions@lists.sourceforge.net>
Sent: Monday, April 04, 2005 10:46 AM
Subject: Re: [iText-questions] PdfTable background and borders



Thanks Steve

I have created a very small example that illustrates the bug.
I know PdfPTable is a lot better, but I mainly use PdfTable because it
offers rowspans.

Steve Appling schrieb:

This should be handled already.  It seems to work fine in my simple
tests.  Do you have a SIMPLE example of the problem?  BTW, it is
probably better to use PdfPTable if you can.

----- Original Message ----- From: "David Perez" <[EMAIL PROTECTED]>

To: "iText" <itext-questions@lists.sourceforge.net>
Sent: Monday, April 04, 2005 5:14 AM
Subject: [iText-questions] PdfTable background and borders


Hi all,

I think I have found a bug in PdfTable (iText 1.02 but seems to also
appear in the latest iText 1.2).
I have several cells with a background color and can hide the border of
neighboring cells.
After having reviewed the source code (PdfDocument.java), I find two
solutions:

  1. Paint the background in a different layer (PdfContentByte) than
     the border.  Currently borders and background are painted in a
     separate ContentByte (writer.getDirectContentUnder())
  2. Paint first all the background of the table, then the cell border
     and finally the table border.

What do you think?

Regards,
   David Pérez







-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to