Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

[iText] MultiColumnText

Thread view: 
Ingo R. Homann - 21 Sep 2005 08:24 GMT
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
Ingo R. Homann - 21 Sep 2005 13:52 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.