Searching the attached document for “text” only returns hits form the first page, although the word exists on all three pages. GroupDocs Parser 20.12 was used with the following code:
Aspose Sample.zip (42.6 KB)
using (Parser parser = new Parser("Aspose Sample.docx"))
{
// Search a keyword with page numbers
IEnumerable<SearchResult> sr = parser.Search("text", new SearchOptions(false, false, false, true));
// Iterate over search results
foreach (SearchResult s in sr)
{
// Print an index, page number and found text:
Console.WriteLine(string.Format("At {0} (page {1}): {2}", s.Position, s.PageIndex, s.Text));
}
}