Hi there,
this is my first request to this mailing list, so please let me
apologize for being a newbie here.
I have been working with iText occasionally and currently I'm facing
such an occassion again. In my project I have been producing only pdf
reports so far, which really worked very nicely with iText (big praise
to the Mr. Lowagie). Now is the time to also tackle rtf reports and I
was adapting my code to be able to also produce nice rtf documents.
However I was running into a particular problem that I couldn't fix so far.
Here is some simply sample code. I try to use the general iText classes
as far as possible:
public static void main(String[] args) throws Exception {
FileOutputStream fout = new FileOutputStream("chapter.rtf");
ByteArrayOutputStream out = new ByteArrayOutputStream();
// create document and writer
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
RtfWriter2.getInstance(document, out);
// open the document
document.open();
// create a chapter
Paragraph cTitle = new Paragraph("Chapter 1 - What the fuzz?");
Chapter chapter = new Chapter(cTitle, 1);
chapter.setNumberDepth(0);
document.add(chapter);
// create a section
Paragraph p = new Paragraph("I can see the stars");
Section section = chapter.addSection(p, 1);
section.setNumberDepth(1);
document.add(section);
// some text phrase
String text = "This is the section text";
Paragraph paragraph = new Paragraph(text);
document.add(paragraph);
// close the document
document.close();
// and finish the streams
out.writeTo(fout);
fout.flush();
fout.close();
}
This piece of code generates a rtf document. However with many additions
I don't want to have:
1) a section page break after the chapter (thus the first page is empty
except for the chapter)
2) two newlines after the section header
Is there I way to remove both side-effects?
Any help appreciated,
thanks,
Karsten
begin:vcard
fn:Karsten Klein
n:Klein;Karsten
org:LION bioscience Ltd.
adr:80-82 Newmarket Road;;Compass House;Cambridge;;CB5 8DZ;United Kingdom
email;internet:[EMAIL PROTECTED]
title:Principal Software Architect
tel;work:+49 6221 4038384
tel;cell:+49 179 4815959
note;quoted-printable:=0D=0A=
PRIVACY & CONFIDENTIALITY NOTICE=0D=0A=
This e-mail may contain confidential and/or privileged information. If=
you are not the intended recipient (or have received this e-mail in erro=
r) please notify the sender immediately and destroy this e-mail. Any unau=
thorized copying, disclosure or distribution of the material in this e-ma=
il is strictly forbidden. Any attachment - if any - to this message has=
been checked for viruses, but please rely on your own virus checker and=
procedures, as we do not bear any responsibility and/or liability for=
damages resulting in this regard or connected therewith.
url:http://www.lionbioscience.com
version:2.1
end:vcard