The following code doesn't have a blank line after a page break.
doc.addPageBreak();
Paragraph p0 = doc.getParagraphByIndex(0, false);
p0.setTextContent("First Paragraph");
p0.applyHeading(true, 1);
However, applyHeading isn't working.
The following will apply heading level 1, but has the original problem of a
blank line before the paragraph.
doc.addPageBreak();
doc.addParagraph("First Paragraph").applyHeading(true, 1);
Alan
On Thu, Aug 22, 2013 at 1:51 PM, Alan Knight <[email protected]> wrote:
> It's not a style issue. The second paragraph doesn't have the blank
> line. If I turn on the non-printable characters view in Open Office, I see
> there are three paragraph marks. One is on the blank line before "First
> paragraph" and the other two are at the end of "First paragraph" and
> "Second paragraph".
> However, I did just find a work around. If I replace the first
> addParagraph() with
>
> Paragraph p0 = doc.getParagraphByIndex(0, false);
> p0.setTextContent("First Paragraph");
>
> there is no more blank line. Now to see if this works after calling
> addPageBreak();
>
> Thanks,
> Alan
>
>
>
> On Thu, Aug 22, 2013 at 3:22 AM, Rory O'Farrell <[email protected]> wrote:
>
>> On Thu, 22 Aug 2013 03:04:37 -0400
>> Alan Knight <[email protected]> wrote:
>>
>> > In the following code I get a blank line before the first paragraph.
>> >
>> > TextDocument doc = TextDocument.newTextDocument();
>> > doc.addParagraph("First paragraph");
>> > doc.addParagraph("Second paragraph");
>> > doc.save("doc.odt");
>> >
>> > I also see this with a paragraph added after a
>> > TextDocument::addPageBreak();
>> >
>> > Does anyone know how to avoid the blank line?
>> >
>> > I'm using the latest version of the simple API (0.6). However, I had to
>> > download a lot of additional jar files to make that version run. Just
>> > downloading the 0.6 JAR files and running the example above gives me a
>> > java.lang.NoClassDefFoundError: org.apache.clerezza.utils.UriException.
>> > After downloading about 15 additional JAR files, I was able to get the
>> > example to run.
>> >
>> > Thanks,
>> > Alan
>>
>> I suspect you need to modify the Default paragraph style on the target
>> computer to remove either the Spacing : Above paragraph or the Spacing :
>> below paragraph.
>>
>>
>> --
>> Rory O'Farrell <[email protected]>
>>
>
>