2012-09-12 40 views
1

我有以下VB.Net代碼來創建Microsoft Word文檔。我如何施加頁碼?使用Microsoft.Office.Interop.Word時強加頁碼

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() 

回答

1

你可以嘗試:

'wdAlignPageNumberCenter=1 
wordDoc.Sections(1).Footers(1).PageNumbers.Add (1) 
+0

非常感謝Remou! – Dogahe

相關問題