1

I have the following VB.Net code to create a Microsoft Word document. How can I impose page numbering?

Imports Word = Microsoft.Office.Interop.Word

Dim wordApp As Word._Application = New  _
Word.ApplicationClass()

Dim wordDoc As Word._Document = _
    wordApp.Documents.Add()

Dim para As Word.Paragraph = wordDoc.Paragraphs.Add()
para.Range.Text = "First Page Content."
para.Range.InsertParagraphAfter()

para.Range.InsertBreak()

para.Range.Text = "Second Page Content."
para.Range.InsertParagraphAfter()
SeanC
  • 15,695
  • 5
  • 45
  • 66
Dogahe
  • 1,380
  • 2
  • 20
  • 50

1 Answers1

1

You could try:

 'wdAlignPageNumberCenter=1
 wordDoc.Sections(1).Footers(1).PageNumbers.Add (1)
Fionnuala
  • 90,370
  • 7
  • 114
  • 152