| By Date: | <-- --> |
| By Thread: | <-- --> |
On Wednesday 08 February 2006 10:46, Sidney wrote:
> I am using RtfWriter2 to generate a RTF document. I use
> com.lowagie.text.List to generate a list and put it in a
> com.lowagie.text.rtf.table.RtfCell object. I know that the RtfCell object
> doesn't support adding in the ListItem. But can I add in a List object?
> Also I wanna ask is there any problem for my code below? Actually the code
> doesn't come out with any exceptions or errors during compilation or
> generating the rtf document.
There was a bug in the handling of List elements in table cells that has been
fixed.
> Table table = new Table(1);
> RtfCell cell = new RtfCell();
>
> cell.addElement("Line 1 before List");
> cell.addElement("Line 2 before List");
>
> List list = new List(true, 0);
> list.add(new ListItem("Point 1"));
> list.add(new ListItem("Point 2"));
> list.add(new ListItem("Point 3"));
>
> cell.addElement(list);
> cell.addElement("Line 1 after List");
> cell.addElement("Line 2 after List");
> table.addCell(cell);
>
> doc.add(table);
You cannot (at least as far as I am aware and I get a compiler error if I try
it) add a String to a Cell with addElement. You need to wrap it in a
Paragraph or similar. Apart from that the code is functional.
Greetings,
Mark
--
A horse! A horse! My kingdom for a horse!
-- Wm. Shakespeare, "Henry VI"
My GPG public key is available at:
http://www.edu.uni-klu.ac.at/~mhall/data/security/MarkHall.asc
Attachment:
pgp3i1XqyhQ84.pgp
Description: PGP signature