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

Free Support Forum - aspose.com

How to get page number of certain text in the word document


I am trying to search for specific text in the word document and find the page number in which the text was found in the document. I could able to find the text but could not able to get page number. Please help.


Hi Rama,

Thanks for your query. Please read following documentation link for your kind reference. Hope this helps you. let me know, If you have any more queries.


I regret to share with you that there is no built in method to find the page number of a node. However, there is a workaround to find page number. Please read following documentation link for .NET code. I will share Java code with you soon.



Thanks for the update. However, I have another question. Is there a simple way to find the text instead of implementing the callback function?



Hi Rama,

You can get the text from document by following line of code. You can find text from string variable by using string methods. Let us know, If you have any more queries.

string text = doc.Range.Text;

Hi there,

Thanks for your inquiry.

I’m afraid you will need to use the callback in order to find the Run node of specified text.


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.