The cell copy is there for a reason. When the width is set for the table the
dimensions are calculated. If some cell changed there would be no way of
knowing it. I could have some kind of refresh but that would be adding
another level of complication and I want to avoid the problems that Table is
still plagued with. The other problem is what if you inserted repeatedly the
same cell, only changing the padding or something else. The result would be
an table with the last cell change repeated. The copy is not very deep
because it's unlikely that a Phrase is changed after construction.
Best Regards,
Paulo Soares
> -----Original Message-----
> From: Wojciech Wisniowski [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, July 16, 2002 20:45
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] PDFPTable and addCell( cell) problem
>
> 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
-------------------------------------------------------
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