Hello,
I have one problem using iText library and PdfPTable. (BTW: it is very
usefull tool!!)
I create "template" of PdfPTable using my own xml utility and then I fill
out all cells with data retrived from database.
I store references to cells in vector (or hastable) for further reference
(fill content and e.g. padding).
Unfortunately this solution does not works properly, because method
PdfPTable.addCell( PdfPCell c1) creates internal copy of c1 argument:
public void addCell(PdfPCell cell) // sorce code: PdfPTable.java
{
PdfPCell ncell = new PdfPCell(cell);
.......
}
(it is not really deep copy, because c1 and and ncell shares the some
instance of the phrase)
Having reference to c1 I can modify content of the ncell but I can not
change e.g padding ot this cell.
My situation is more complex but it does not work in much simpler example:
PdfPCell c1= new PdfPCell( new Phrase("my cell"));
table.addCell(c1);
..
..
c1.setPaddingTop( 10 ); // does not effects table formating !!
I do not know, if my needs are very strange or stupid. I do not think so :-)
I think it is very simple solution to solve this problem ( my s\uggestion to
Paulo) changing the addCell method:
public PdfPCell addCell(PdfPCell cell) // void changed to
PdfPCell
{
PdfPCell ncell = new PdfPCell(cell);
.......
return ncell; // return
copy of new cell
}
In this way is possible to modify the cell formating not only before adding
cell to the table.
Paulo, what do you think about this proposition?
Best regards
Wojtek
-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing
real-time communications platform! Don't just IM. Build it in!
http://www.jabber.com/osdn/xim
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions