Table of contents shows incorrect pagenumbers

I am generating a Word document with some large tables and pictures. After all is complete a call is begin made to update all fields in the document, including the table of contents on page 2.

The table of contents shows all chapters correct, but the pagenumbers are incorrect after page 5. When I open the generated Word document in Word itself and update the table contents from there, all pagenumbers are being corrected.

Problem can be reporduced by openening the attached file with Aspose, call the document.Update and save the file again. The TOC will still show incorrect page numbers

I am generating a Word document with some large tables and pictures. After all is complete a call is being made to update all fields in the document, including the table of contents on page 2.

The table of contents shows all chapters correct, but the pagenumbers are incorrect after page 5. When I open the generated Word document in Word itself and update the table contents from there, all pagenumbers are being corrected.

Problem can be reporduced by openening the attached file with Aspose, call the document.Update and save the file again. The TOC will still show incorrect page numbers




----

After some more research, this problem only occurs when code is executed on Windows Server 2012, on Windows 8, the TOC displays the correct pagenumbers

Hi Marcel,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10190. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Marcel,

Thanks for your patience. Could you please convert your document to Pdf at Windows Server 2012 and Windows 8 using Aspose.Words and share those Pdf files here for our reference for further investigations?

Please find the attached pdf’s. I just converted the docx from the earlier attachment to pdf with:


var doc = new Document(@“Test.docx”);
doc.Save(@“Test.pdf”, SaveFormat.Pdf);

See I did not call updatefields before saving. Do I need to do that?

Hi Marcel,

Thanks for sharing the Pdf files. Please call the Document.UpdateFields method before saving the PDF document and share those PDF files here for our reference. We appreciate your cooperation for this.

Please find attached the PDF’s with updated fields. The server 2012 PDF version has slightly different pagenumbers than the Word version, but still not correct

Hi Marcel,

Thanks for sharing the PDF documents. It seems that fonts on Windows 8 and Windows Server 2012 are not same. If we need more information form our side while investigating this issue, we will let you know. Thanks for your cooperation.

Do you think there is a workaround for the moment? Maybe try another font?

I have copied Lucida Sans font from my Windows 8 machine to Windows Server and it looks like the pagenumbers are correct now.

Lucida Sans font is part of Microsoft Office installation which is not installed on Windows Server.

I will generate some more documents next week and I will let you know what the results are.

Thanks so far!

Hi Marcel,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Most probably, this issue is related to fonts. Please let us know if you still face the same issue at your end.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan