We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Incorrect page number - Word document

Hi,

I'm facing with a problem when building a TOC (table of contents). I have about 20 .docx files. After I merged these words into the one destination file. The destination file has 70 pages and the page number showed correctly in the footer section.

I tried to build the TOC: get the page number basing on the bookmark on the pages that we want to get the page number.

And the numbers are returned wrongly. For example, it returned 36 for the page 35, it returned 92 for the page 70....

I'm not sure if this is an issue of ASPOSE word component or not.

I see one the similar topic related to PageCount and it also returns wrong number. Not sure this issue was fixed or not.

https://forum.aspose.com/t/65456

Can you please take a look on this problem?

Thanks,

Hi,


Thanks for your inquiry. Please call Document.UpdateFields method before saving your final document as shown below. Hope this solve your problem.

Document doc1 = new Document(MyDir + “input1.docx”);<o:p></o:p>

Document doc2 = new Document(MyDir + “input2.docx”);<o:p></o:p>

doc1.AppendDocument(doc2, ImportFormatMode.KeepSourceFormatting);<o:p></o:p>

doc1.UpdateFields();<o:p></o:p>

doc1.Save(MyDir + “AsposeOut.docx”);


I suggest you to read following documentation links for your kind reference. Please let us know if you have any more queries.

http://www.aspose.com/docs/display/wordsjava/How+to+Update+Fields
http://www.aspose.com/docs/display/wordsjava/Differences+in+Field+Update+in+Aspose.Words+10.0+and+Above