How to reset all pages number and reset it again

Hi Aspose,

I’m using Aspose.Words to append many documents to a destination file. The output result looks good, but the page number of whole page are displaying incorrect. Here is my case:
- Document 1: This doc contains 3 pages with page number is 1,2,3.
- Document 2: This doc contains 5 pages with page number is 8,9,10
- Document 3: This doc contains 6 pages with page number is 20,21,22,23,24,25,26

My question is: How to reset all pages number in the destination file after appending and re-apply it into this output? The page number in the new output must be increased from 1 to end.

Thanks.

Hi ChienVH,

Thanks for your inquiry. Please call Document.UpdateFields method before saving your final document as shown below:

Document doc1 = new Document(MyDir + "input1.docx");
Document doc2 = new Document(MyDir + "input2.docx");
doc1.AppendDocument(doc2, ImportFormatMode.KeepSourceFormatting);
doc1.UpdateFields();
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.
https://docs.aspose.com/words/java/update-field/
https://docs.aspose.com/words/java/update-field/

Thanks Tahir Manzoor, it works fine

Hi ChienVH,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.