The answer I have found myself is to use Dynamic Chunks, chunks that derive from this class:

 

abstract class DynamicChunk extends Chunk {

      public DynamicChunk () {

            content = new StringBuffer();

            font = new Font();

            // Has to be set otherwise page number is always zero

            setGenericTag("test");

      }

      public String content() {

            content.delete(0, content.length());

            content.append(getContent());

            return content.toString();

      }

      /**Gets the real contents*/

      protected abstract String getContent();

}

 

 

Chunk content is build on request, so it is possible to build once a table that must be repeated several times and to change anything that is needed.

 

Hope this proves useful for anyone that has the same needs than me.

--------

David

 

-----Mensaje original-----
De: Carmona Perez, David
Enviado el: viernes, 20 de febrero de 2004 11:42
Para: Itext-Questions (E-mail)
Asunto: [iText-questions] Changing PdfPTable cell data

 

Hi all,

 

I have to draw a table several times, with slightly different data.

 

Does anyone know if I can change the contents of a cell?

I don’t know if its safe to do so, because I haven’t seen any method for accessing to a cell, given its coordinates.

 

Thanks in advance for any help.

--------

David

 

Reply via email to