Extract Page number form word doc using OpenXML.

Prithvi Raj Singh 21 Reputation points
2022-03-16T14:42:34.34+00:00

I have a word document and I want to extract the page number of each page with unique word/title and put it in separate Excel file. How can do this using OpenXML?

Thank you!

Developer technologies C#
{count} votes

Accepted answer
  1. Michael Taylor 60,161 Reputation points
    2022-03-16T15:58:52.533+00:00

    My understanding is that OpenXML doesn't support this. Page numbers are determined by the renderer (for example Word). The issue is with soft breaks as the renderer determines when to move to the next page and that isn't stored in the document.

    Here's a link to where someone asked a similar question and was given some starter code to try to get page numbers. But that only works with hard breaks. Refer to this article for more information as well.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.