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

Free Support Forum - aspose.com

How to identify on which page my paragraph is there in word document using aspose.words?

how to identify on which page my paragraph is there…if first paragraph has 1 and half page of content and if i merge second paragraph then i will get second paragapth in mid of the page …in tht case how to idenfigy my second paragraph is on which page ?


Thanks for your request. There is no direct method to get number of page where paragraph is located. However, you can try using code like the following to achieve this:

Document doc= new Document(@“c:\temp\in.docx”);
DocumentBuilder builder = new DocumentBuilder(doc);

builder.MoveToParagraph(1, 0);

// Insert a PAGE field and update it.
Field page = builder.InsertField(“PAGE”);

int pageNumber = int.Parse(page.Result);

// Remove PAGE field.


I hope, this will help.

Best Regards,