I have a client who is reporting that their TOC page numbers become incorrect after uploading their documents to our application. After some investigation I discovered that this happens after Document.UpdateFields() is called.
We are currently using version 20.2 of Aspose.Words (.NET) in production. I updated my development environment to 20.9 (the latest version at the time of writing) but it did not resolve the issue.
In the zip file that I’m attaching there are two word documents:
- BeforeUpdateFields.docx: The original file, notice that under section 3 of the TOC, reporting concerns is said to be on page 9 which is correct.
- AfterUpdateFields.dox: Notice that reporting concerns is now said to be on page 8 which is incorrect.
Calling Document.UpdatePageLayout() after Document.UpdateFields() did not help. Also, I saw that this can sometimes be caused by not having the correct fonts installed. This document uses the Century Gothic font and I have verified that the font is installed on my development machine.
TOC Issue.zip (161.1 KB)
@christian.batchelor
We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-21158 . You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
Thank you for the quick response, I appreciate it. Let me know if there is any additional information you need from us. This issue is important to us and our client so we will be prompt with our responses.
@christian.batchelor
We will ask you more information if it is needed. We will inform you via this forum thread once there is an update available on it.
@tahir.manzoor
I was troubleshooting this a bit today, and I’m wondering if the issue is with the footnotes. Perhaps the space that they take up is not being accounted for by the TOC? The “Reporting Concerns” section in the example document is on the first line of page 9, and at the end of page 8, there is a footnote. I removed the footnote and ran the document through Aspose again, which put the “Reporting Concerns” section on page 8, making the TOC correct. Do you think I may be on to something here?
@christian.batchelor
The issue you are facing is related to missing feature WORDSNET-9957 (ROOT Header contents overlap with the body content in output Pdf). Aspose.Words does not support header/footer text wrapping around floaters.
There is a floating table in the footer of document. Aspose.Words does not wrap the footer text around the table, the footer height is not correct in Aspose.Words layout.
Incorrect footer height causes different text flow and so some TOC items are on different pages.
As a workaround, please make the text wrapping of table as inline.
@tahir.manzoor Thanks for the workaround and the additional information, it is much appreciated. The workaround seems to have worked in my testing. However, the client has shown reluctance to modify their documents since they are many. So we are still eager for a fix.
Thank you for your work on this issue.
@christian.batchelor
Sure, we will inform you via this forum thread once this issue is resolved or an update available on it.
The issue may be something other than the floating table in the footer. Our client was slow to respond when I provided them with the workaround, but I was on a call with them today and can confirm that removing the wrapping text from the footer’s table and then running it through again did not resolve the issue.
Unless I am misunderstanding the workaround, this is what the table settings look like on the problem document’s footer:
image.png (6.9 KB)
@christian.batchelor
Yes, your understanding is correct. The problematic table can be made inline as a workaround.
@tahir.manzoor
Any update on when we can expect a fix for this issue?
@christian.batchelor Unfortunately, the issue still has postponed status. We apologize for your inconvenience.
We will inform you within this forum thread as soon as we have more information.
The issues you have found earlier (filed as WORDSNET-21158) have been fixed in this Aspose.Words for .NET 23.5 update also available on NuGet.