We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to Iterate through textranges by page

I'd like to be able to examine the text in all text ranges in a word document and know which page each word is on.

I can't see a way to programmatically determine this.  Can someone tell me if this is possible using DocIO and where I could look for more information or a code sample?

3 Replies

MJ Mohanaselvam Jothi Syncfusion Team August 2, 2017 01:21 PM UTC

Hi Brian,

Thank you for using Syncfusion products.

The Word document is a flow document in which contents will not be preserved page by page; instead the contents will be preserved sequentially section by section. Each section may extend to various pages based on its contents like table, text, images etc. Word viewer/editor renders the contents of the Word document page by page dynamically when opened for viewing or editing and these page wise rendered information will not be preserved in the document level as per the Word file format specification. Whereas Essential DocIO is a non UI component that provides a full-fledged document object model to manipulate the Word document contents. Hence currently it is not feasible to get the document contents page by page.
For your reference please refer the below code snippet to get the section for the corresponding text range. 
Code Snippet: 
//Get the section of the textrange. 
WSection section = (textRange.OwnerParagraph.OwnerTextBody.Owner as WSection); 
Could you please update us your exact working scenario which will be helpful for us to provide you a prompt solution at the earliest. 

Please let us know if you have any other questions.



BB Brian Benson August 2, 2017 01:33 PM UTC

Thank you for your reply.

From what I could tell, there was no way to keep track of pages, but I thought I would ask just in case I missed something.

MJ Mohanaselvam Jothi Syncfusion Team August 3, 2017 06:42 AM UTC

Hi Brian,

Thank you for your update. Please let us know if you need any further assistance. We will be happy to assist you as always.


Live Chat Icon For mobile
Up arrow icon