Hi Howard,
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.
However, you can achieve your requirement by using the utility method available in the attached ‘PageNumberFinder’ class.
Document doc = new
Document(MyDir + “in.docx”);<o:p></o:p>
DocumentBuilder builder = new DocumentBuilder(doc);<o:p></o:p>
PageNumberFinder finder = new
PageNumberFinder(doc);<o:p></o:p>
foreach (Bookmark bm in doc.Range.Bookmarks)<o:p></o:p>
{<o:p></o:p>
builder.MoveToBookmark(bm.Name);<o:p></o:p>
int page = finder.GetPage(builder.CurrentNode);<o:p></o:p>
Console.WriteLine(page);<o:p></o:p>
}
Moreover, please check using the DocumentLayoutHelper sample from the offline samples pack. This sample demonstrates how to easily work with the layout elements of a document and access the pages, lines, spans etc.
Hope this helps you. Please let us know if you have any more queries.