locked
Read page number of word document by interop word RRS feed

  • Question

  • Hi everyone!

    I have a c# application and I want to read page number field of each page.

    i.e. A,B,C... or 1,2,3... or i,ii,iii...

    Please Help!

    Thanks!

    Thursday, June 19, 2014 12:04 PM

Answers

All replies

  • Try and ask here: http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=worddev

    Kind regards,
    Margriet Bruggeman

    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

    • Proposed as answer by Dave PatrickMVP Friday, June 20, 2014 2:27 AM
    • Marked as answer by Just Karl Friday, June 27, 2014 9:52 PM
    Thursday, June 19, 2014 2:50 PM
    Answerer
  • A footer is not on a page and a page number in a footer is a field that potentially identifies with multiple pages. In a Word document file, there are no pages. Pages are set as a part of the printing process.

    It is possible with the file open in Word to identify a page number using vba but it is not part of the document itself, the field needs not just to be read but to be activated.

    Every Word document contains at least one section. Each section has three headers and three footers in the structure, whether or not they are displayed. A page can have more than one section, each with its own headers and footers and potentially each with its own page numbers in those headers or footers. The headers and footers are in a completely separate part of the document (layer) from the document body.

    You'll need to take a different approach. Essentially, the document needs to be open in Word with a particular printer attached. Then you might be able to get vba to give you a reading for the page. (Word does not really think in  terms of pages despite attaching page numbers through fields.)


    Charles Kenyon Madison, WI

    Tuesday, July 18, 2017 8:19 PM