I am trying to parse a Word document and the information I am looking for should be located on the first page only. Is there any way to get the page number for a paragraph?
foreach (Word.Paragraph p in document.Paragraphs)
{
// pageNo = .....
// if(pageNo == 1 && p.Range.Text.StartsWith("This")) {
// /* do some processing with the paragraph */
// }
}
From this post VSTO 2007: how do I determine the page and paragraph number of a Range? i could see you could get Page number form a range
And from this post, how to detect Empty paragraph in Word Document using Microsoft.Office.Interop.Word in C#4.0? i am sure u could find the Range from the paragraph!
you should have your solution combining both the answers, i bet!