Free Support Forum - aspose.com

Page number of Table of Content is incorrect in output DOCX using C#

Hi Aspose Team,

We are facing an issue on page number from the Table of Content after downloading word document using Aspose. Please have a look into below scenario to get it understand clearly:

Scenario:
When we are navigating to any page from the “Table of Content” then the page number which is showing against title (in Table of Content) is not matching to the one where we are navigated. (showing one less than what it is in Table Of Content)

For example:
In table of content, suppose we have page number 45 which is showing up against any title but when we are navigating to that actual page from the Table Of Content then it is showing as 44 in the footer.

Note:
I am using “builder.InsertField(“PAGE”, “”);” for implementing the page number in Aspose word doc.

Please have a look into the above issue and let me know if have any solutions for that. It will be great if you can attach any code for this solution.

Thanks in advance !!

Looking forward to hear from you soon.

Thankyou
Prakhar Agarwal

@prakhar6355

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

@tahir.manzoor

Thankyou so much for the quick response.

As per your requirement, i don’t have any input document to attach here since we are fetching all the document sections from database as a HTML string in our application.

Please let me know if you have any solution on that.

Looking forward to hear from you soon.

Thanks,
Prakhar Agarwal

@prakhar6355

Please ZIP and attach HTML string here for testing. Thanks for your cooperation.