Free Support Forum -

Search returns null for PageIndex for DOCX in .NET

Search returns null for PageIndex when searching the attached .docx file.
I used GroupDocs.Parser 20.12 with the following code: (10.2 KB)

using (Parser parser = new Parser("Landscape.docx"))
// Search a keyword with page numbers
IEnumerable<SearchResult> sr = parser.Search("usage", 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));

I know that PageIndex is of type “int?” so it can be null.
But I don’t really know why… If I have the “searchByPages” parameter set to true as you can see in code, I think it should never be null. What good is a search result if I don’t know on which page it was found?


We’re investigating this scenario with ID PARSERNET-1725 and we’ll notify you in case of any progress update.

1 Like

The issues you have found earlier (filed as PARSERNET-1725) have been fixed in this update. This message was posted using Bugs notification tool by albertakhmetov