Hi again,

Thanks for the quick reply! :)

I took a second look at the thing and I'm not sure if I understand
Section.isTriggerNewPage() (it seems to work together with notAddedYet flag).

So I tried putting this setting into RtfDocumentSettings (although maybe this setting should not be together with more "miscellaneous" settings, I guess).

If it helps, my two cents are attached as a diff to svn trunk :).

Regards,
Kimmo Koskinen

Attachment: chapters-without-newpage.diff
Description: Binary data




On 2.5.2008, at 15:41, Howard Shank wrote:

Hi Kimmo,

Hopefully I can get time to look at this over the weekend. I'm working on some other changes involving importing, chapters and sections, but maybe I can squeeze in time to look at this too.

Regards,
Howard Shank

----- Original Message ----
From: Kimmo Koskinen <[EMAIL PROTECTED]>
To: iText mailing list <itext-questions@lists.sourceforge.net>
Sent: Friday, May 2, 2008 6:57:52 AM
Subject: [iText-questions] Rtf Chapters and page breaks

Hi,

We've been using iText in our product and it's done a great job!
However, I noticed that when generating a RTF document with Chapters,
a page break is made after the Chapter title. This results in many
allmost empty pages and alot of work editing the document afterwards.

Section class has a method setTriggerNewPage() but this does not seem
to work with RTF (atleast not as I expected). So, after browsing the RTF
spec from M$ [1], I tried inserting \sbknone in
RtfChapter.writeContent()
According to the spec, Section break starts a new page by default,
inserting
\sbknone seems to behave as I wanted (content after the Chapter is not
shifted
onto a new page.

The fix is quite crude, and not controlled by setTriggerNewPage(). I'm
not sure
if this is the correct way to get the result, any comments?

Best regards,

Kimmo Koskinen

[1] 
http://www.microsoft.com/downloads/details.aspx?FamilyId=DD422B8D-FF06-4207-B476-6B5396A18A2B&displaylang=en
    page 79

Index: src/rtf/com/lowagie/text/rtf/text/RtfChapter.java
===================================================================
--- src/rtf/com/lowagie/text/rtf/text/RtfChapter.java (revision 3315) +++ src/rtf/com/lowagie/text/rtf/text/RtfChapter.java (working copy)
@@ -88,6 +88,7 @@
         }
         result.write("\\sectd".getBytes());
         document.getDocumentHeader().writeSectionDefinition(result);
+        result.write("\\sbknone".getBytes());
         if(this.title != null) {
             this.title.writeContent(result);
         }



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar



____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to