--- Bruno Lowagie <[EMAIL PROTECTED]> wrote:
> John M. Gabriele wrote: > > >I also need to remove all borders from it -- so the text is > >just floating there. :) I see that I can use a Table and > >then setBorderWidth( 0 ) to remove that one big border around > >the entire table. Can I do something similar with the PdfPTable? > > > > > A PdfPTable hasn't got a border around the entire table. Ah. I see what you mean. The Table gives me a black border that seems to overlap the grey cell borders, but the PdfPTable shows only the grey cell borders. > (You can add one with a PdfPTableEvent.) > > >I also need to remove the borders from the individual cells > >inside the table. (I suppose that I can use either PdfPCells or > >Cells. What's the rule of thumb there (for deciding between > >the two)?) > > > > > PdfPCells can only be used in a PdfPTable. > Cells can only be used in a Table. Hmm... as an aside: Over here, I can put PdfPCells into a Table, but the spacing doesn't look quite right. In fact, even putting Cells into a table doesn't look quite right -- there's no default padding on the right side text (no margin on the right). I can also put Cells into a PdfPTable, and that works too. Spacing seems correct. Maybe this is one of those things that isn't really supposed to work, and if it does, don't rely on it working in a subsequent release? :) > >I've tried mycell.setBorderWidth( 0 ) (like I did with the > >Table above) but it doesn't work with the Cell or PdfPCell > >for me. > > > > > That's because you shouldn't remove the borders by setting the width to 0. > You should use this method (Cell and PdfPCell extend Rectangle): > http://itextdocs.lowagie.com/docs/com/lowagie/text/Rectangle.html#setBorder(int) > with value Rectangle.NO_BORDER > http://itextdocs.lowagie.com/docs/com/lowagie/text/Rectangle.html#NO_BORDER > > >It looks as if, with either Cell or PdfPCell (since they > >both inherit from Rectangle), I'm supposed to be able to do: > >disableBorderSide( Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP | > >Rectangle.BOTTOM ) > >but that's not working for me. I've also tried setBorder( 0 ) > >but that fails to do anything either (that is, the grey border > >on the page around the cells in my table is still there). > > > > > Oops, you already tried my advice. Wait a sec... [time passes] Doh! I got it! :) When it came time to add the cell to the table, instead of adding the cell, I was accidentally adding the paragraph object I'd constructed to go into the cell! This also explains why I was seemingly able to add a Cell to a PdfPTable and a PdfPCell to a Table! :) I was only adding the paragraph all along. Which seems weird -- I thought I had to *only* put cells into tables... Regarding what Jay Parashar wrote: > > A PdfPTable is more versatile than a table. You can place it at absolute > positions. To remove borders for a PdfPCell you can call a custom function > like > private static void disableBorders(PdfPCell cell) > { > cell.disableBorderSide(PdfPCell.LEFT); > cell.disableBorderSide(PdfPCell.RIGHT); > cell.disableBorderSide(PdfPCell.TOP); > cell.disableBorderSide(PdfPCell.BOTTOM); > } That works, but so does cell.setBorder( PdfPCell.NO_BORDER ). Thanks! ---John ____________________________________________________ Sell on Yahoo! Auctions no fees. Bid on great items. http://auctions.yahoo.com/ ------------------------------------------------------- This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual core and dual graphics technology at this free one hour event hosted by HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
