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'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