When I create a Word file using DocumentBulder, The table of contents seems to be generated with the wrong page numbers. I have to update the Word file manually to get TOC numbering corrected.
It seems to be similar to the issue WORDSNET-832 which has been open for a long time.
I created a test case for your investigation and attach it to this thread.
We have tested the scenario using the latest version of Aspose.Words for Java 21.4 and have not found the shared issue. So, please use Aspose.Words for Java 21.4.
We have tested the scenario at Windows 10 using Java 8. We have not found the shared issue. Please check the attached output document. 21.4 out.zip (29.5 KB)
Could you please share the your working environment e.g. operating system, Java version etc.? We will investigate the issue at same environment and provide you more information on your issue.
@behrouz Note that to update page numbers in the TOC Aspose.Words performs document layout. To perform document layout operation Aspose.Words requires fonts used in the document. If the fonts are not available it uses alternative fonts and in this case layout of the document might be different and as a result page numbers might be different too.
So to get accurate result, please, make sure the required fonts are available in your environment. See the following article for more information.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.