I have this document:https://mega.nz/file/EgIXQCCS#V3SjNh9-H32MCjMqQvRIGjXfj6qxlrPmLdwdIQcAxWQ
I want to read all the paragraphs of the document and I have a loop where I iterate to read the paragraphs and when it reaches the pages 2552-2620 / 2695-2954 slows down dramatically and can take days to read all the paragraphs in the file.
I have been able to know how to retrieve the paragraphs of a specific page, to skip the number of paragraphs that it contains, but the paragraphs on the page do not match the paragraphs in the document's paragraph loop.
The content of those pages does not interest me because they are tables. If possible, I would like to skip those pages. any solution?
Application application = new Application();
Document document = application.Documents.Open("C:\\word.doc");
foreach (Microsoft.Office.Interop.Word.Paragraph MyParagraph in document.Paragraphs)
{ int Page = MyParagraph.Range.Information[Microsoft.Office.Interop.Word.WdInformation.wdActiveEndPageNumber];
if ((Page >= 2552 && Page <= 2620) || (Page >= 2695 && Page <= 2954))
{
}
}
application.Quit();
As soon as the foreach loop reaches paragraphs that are on those pages, it practically stops. And they are hundreds of pages.