Page 1 of 1

Table of contents

PostPosted: Tue Apr 18, 2017 7:01 am
by ArkRoyal
Hello.
I have a problem with ToC page numbering, it is wrong.
Even if you see on sample https://github.com/plutext/docx4j/blob/ ... ample.java, there is the mistake in 7th row of contents.
How can it be fixed? Thanks.

Re: Table of contents

PostPosted: Tue Apr 18, 2017 10:29 am
by jason
Noted, thanks. We'll look into it.

Re: Table of contents

PostPosted: Wed Apr 19, 2017 12:15 am
by ArkRoyal
Hi Jason. It was my mistake and I resolved it.
I added break like this:
Code: Select all
        ObjectFactory factory = Context.getWmlObjectFactory();
        MainDocumentPart documentPart = docxPackage.getMainDocumentPart();

        Br breakObj = new Br();
        breakObj.setType(type);

        P paragraph = factory.createP();
        paragraph.getContent().add(breakObj);
        documentPart.getJaxbElement().getBody().getContent().add(paragraph);


In word document everything was good but pdf converter didn't understand these breaks and it just skipped them.