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

Free Support Forum - aspose.com

Page number displayed wrong in footer in DOCX file

Hi,


I am creating DOCX file by writing some values in the document and saving it through Aspose. But the created document shows wrong page number in the footer of the document. Even if the total number of pages is 9, it shows “1 of 3” in the footer of the first page. For other pages it shows correctly as “2 of 9”.

It happens for the first time of generation only. The second time it gets generated correctly (first page showing correct page number).

Can you suggest what would be the possible error ?

Regards,
Prabhaker Kr.

Hi Prabhaker,

Thanks for your inquiry. Please call Document.UpdatePageLayout method before saving the document. This method formats a document into pages and updates the page number related fields in the document such as PAGE, PAGES, PAGEREF and REF.

If you still face problem, please attach your input Word document here for testing along with code example. I will investigate the issue on my side and provide you more information.