How to add page number in word document using Microsoft.Office.Interop.Word in C# ? RRS feed

  • Question

  • I am using Microsoft.Office.Interop.Word to generate word file using C#. While adding page number in footer some of the page number get repeated though section of each page is different. How to identify which page number is getting repeated and How to fix it? How can I manage to add distinct page number in word document?
    Tuesday, February 10, 2015 11:35 AM


  • if you are getting repeated page numbers in a Section, that is because the Section has a 'different first page' and/or 'different odd and even' page setup and whichever header/footer you are NOT adding the PAGE field to is picking up its numbering from a previous Section via the header/footer LinktToPrevious property = True. Each Section in a Word document has three headers and three footers. In a document that has a 'different first page' and/or 'different odd and even' page setup you need to manage each of them.

    Paul Edstein
    [MS MVP - Word]

    Wednesday, February 11, 2015 3:30 AM