Can you use Chapters instead of ListItems? 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Chris O'Connell
Sent: Wednesday, January 03, 2007 9:04 AM
To: [email protected]
Subject: [iText-questions] Rtf question about IText


I'm new to IText and I think it is a great tool. I wish I had discovered it 6 
months ago before I started using Apache FOP to create PDF's. Ugh...

Anyway, I now have to create a (what I thought was) a fairly simple report in 
word. I figured I could use IText to generate a .rtf file and stream it down to 
the browser with a content type of "application/vnd.ms-word", causing the 
browser to pop open Word and my problems are solved...

Well, I can't quite figure out how to lay out the information that I need to 
display. I'm close, but not quite there. I will simplify it, but this is 
essentially what I want to put on the report:

4 List Header 
4.1 First List Item Header
text here. more stuff. description of the first list item
[table]
{page break]
4.2 Second List Item Header
text here. stuff and stuff. description of the second list item.
[table]
[page break]


And just repeat that pattern for a while. The way I'm trying to do this is 
first create a Document and an RtfWriter2. Then, I create what I call the 
'outerList' and then create a ListItem which is a Paragraph with the text "List 
Header". Then add that item to the "outerList". Then, I create another List, 
calling it "innerList". I then add ListItems to the inner list. After I'm done 
adding the items to the "innerList", I add the "innerList" to the "outerList". 
Then, finally, add the "outerList" to the Document and close the Document.

What happens is that first, I can't seem to get the {List Header} item to start 
with number 4. It always wants to start at number 1, despite calling 
"setFirst(4)". Next, I was hoping that the List Items would be numbered "4.1" 
and "4.2" etc. Instead, they just start out being numbered as "1", "2" etc.

So, first, am I just way off base here? Am I trying to be too clever by using 
rtf to fake Word into displaying a Word doc? Second, it is possible to do what 
I want to do, which is have all that arbitrary content show up in between the 
list items? I haven't seen any examples of that, and no matter how I play 
around with things the items from "2" on down are no longer list items. They 
show up in my word document numbered correctly, but Word doesn't think they are 
list items, instead it just thinks that it is some text on a line that happens 
to start with the character "2", "3" etc.

Any help you could give would be greatly appreciated. I've been playing around 
with this for a couple days and I'm starting to get bug-eyed and now I think 
that I am so surrounded by my confusion that I just need a push in the right 
direction from an outside source :)

Thanks, Chris 

Attachment: happy.gif
Description: happy.gif

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to