Obtaining the current page number from the footer

Hi,
My current requirement is to obtain the current page number from the footer and insert unique shapes collection based on the current page number.
This request is related to the following thread
http://www.aspose.com/community/search/search-results.aspx?u=114666&o=DateDescending
My intention is to get the current page number from the footer. Is there any sample to obtain the current page number ?
Regards,
hadi teo

Hi Hadi,

Thanks for your inquiry. Microsoft Word document is a flow document and it does not contain any information about its layout into lines and pages. So there is no way to determine where page starts or ends. The page numbers are represented by a PAGE field in MS Word documents and this field is related to the page layout algorithms in Aspose.Words. When you open a document with MS Word, it calculates the numbers on the fly.

You can achieve your requirement by using the utility method available in the attached ‘PageNumberFinder’ class.

PageNumberFinder finder = new PageNumberFinder(doc);
int page = finder.GetPage(doc.LastChild);

Hope this helps you. Please let us know if you have any more queries.

Hi,
I have executed the following code :

PageNumberFinder finder = new PageNumberFinder(doc);
int page = finder.GetPage(doc.LastChild);

The application returns the ‘page’ value = 1 which is incorrect. The document itself contains 10 pages in total.
Could you please provide more documentation on this ‘PageNumberFinder’ including the usage guide ?
Regards,
hadi teo

Hi Hadi,

Thanks for your inquiry. There is no web documentation available for this utility. However, you can find the comments for most of the methods in PageFinder.cs. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Hi,
thanks for your assistance. I have decided to close this thread, since i need to focus at different area : https://forum.aspose.com/t/89648
Regards,
hadi teo

Hi Hadi,

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

The issues you have found earlier (filed as WORDSNET-2978) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(99)