[iText] MultiColumnText

I

Ingo R. Homann

Hi,

I've got a document generated with iText containing a PdfPTable, that
sometimes becomes so large that it will be split on two pages.

I want to avoid this by dividing the table in two columns within the
page. i.e. from this...:

+--+--+
|A1|B1|
+--+--+
|A2|B2|
+--+--+
|A3|B3|
+--+--+
|A4|B4|
+--+--+

....I want to make this:

+--+--+ +--+--+
|A1|B1| |A3|B3|
+--+--+ +--+--+
|A2|B2| |A4|B4|
+--+--+ +--+--+

I hoped, that the class MultiColumnText would help:

MultiColumnText mct = new MultiColumnText(30);
mct.addRegularColumns(20, 500, 20, 2);

Unfortunately, I've encountered some problems:

- In the constructor of MultiColumnText there is a parameter 'height'.
In which unit is it measured? It does not seem to be the usual 'point'.
Furthermore: The real height of the result "jumps" strangely, i.e. when
changing the 'height' parameter only slightly, the result changes very much.

- I want to add some (SingleColumn) Text below the MultiColumnText. At
the moment, this single column text does not appear directly below the
MultiColumn, but on the lower part of the page. (That is not really a
problem, but I wonder, what is the reason? Can I rely on this? Or is it
a bug?)

- Sometimes, a table row will be split up in the middle. Instead of this...

+--+--+ +--+--+
|A1|B1| |A3|B3|
+--+--+ +--+--+
|A2|B2| |A4|B4|
|a2|b2| +--+--+
+--+--+

....I get this...:

+--+--+ |a2|b2|
|A1|B1| +--+--+
+--+--+ |A3|B3|
|A2|B2| ...


- It would be nice, if it were possible to add a table header after a
"column break" (Oh - perhaps this is possible using setHeaderRows(),
I'll try this.)

Especially because of the problem with the "splitted table row" I doubt
that my problem can be solved using a MultiColumnText. Perhaps, it would
be easier to build an own solution using a surrounding table? (What
problems will I encounter then?)

Ciao,
Ingo
 
I

Ingo R. Homann

Hi,
[problems with MultiColumnText]

For everybody, who is interested: All the problems I described could be
derived to the fact that between the following lines...:

MultiColumnText mct = new MultiColumnText(30);
mct.addRegularColumns(20, 500, 20, 2);
mct.add(...);
// (*)
mct.add(...);
doc.add(mct);

....there was a "doc.add(...);" somewhere. Obviously, iText does not like
that (which I think, is understandable...)

Ciao,
Ingo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top