I am generating Word document that contains two table of contents. I have the following code to deal with table of contents:
document.updateFields();document.updatePageLayout();
The resulting/generated document has incorrect page numbers in the tables of contents. After spending time and researching the forum for a solution I found some information referring to fonts. Seems like by default it refers to /usr/share/fonts which is empty in my case. I had to reset it to the different path:
FontSettings.getDefaultInstance().setFontsFolder(myNewPath, false);
After I added the above code to change font location, everything seems to work.
Here are the few questions I would like to receive the answers to:
- Why do I need the fonts in order for TOC to work? Everything worked fine until I added support of TOC
- Which font exactly is required?
- Do the fonts required depend on the document itself?
I need to understand how it might affect the existing solution I have and documents that have been generated correctly so far.