w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to set page numbering to start at chosen value in Word

The best way I know of figuring out a way to do stuff in Word is by recording a Macro and then viewing the generated code. It's VB, but it's pretty easy to translate it into C#. In Word 2007, if I record a macro that changes the Start at you're talking about I'm getting the following macro -

 Sub Macro1()
    '
    ' Macro1 Macro
    '
    '
        With Selection.Sections(1).Headers(1).PageNumbers
            .NumberStyle = wdPageNumberStyleArabic
            .HeadingLevelForChapter = 0
            .IncludeChapterNumber = False
            .ChapterPageSeparator = wdSeparatorHyphen
            .RestartNumberingAtSection = True
            .StartingNumber = 3
        End With
    End Sub

You're only interested in changing the StartingNumber property and the translation into C# is straightforward.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.