Word.java: Index and toc

I don’t seem to be able to generate a proper index AND a table of content in the same document.
When I do the TOC is not correct.

In order to demonstrate that, I attach to the following a base document. If you load it with aspose, call updateFields and save it to a docx or a pdf, the TOC (which is bad) is unchanged.z.zip (30.6 KB)

The code to demonstrate is this:

Document doc = new Document("tocAndIndex.docx");
doc.updatePageLayout();
doc.updateFields();
doc.save("out.docx");        
doc.save("out.pdf");        

The TOC in all the documents (the source, generated with a complex java code) , out.docx and out.pdf all have very wrong page numbers.

I’m using Aspose word Java v 18.2 under Windows

@yvesb,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue with TOC field. We have not found any issue with Index field. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16524. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.