Dim app As New MSWord.Application
try
Dim doc0 As Object = app.Documents.Open("d:\test2.docx")
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageHeader
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageFooter
app.ActiveWindow.Selection.WholeStory
app.ActiveWindow.Selection.Copy
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument
Doc0.Close
Dim doc01 As Object = app.Documents.Open("d:\test2.docx")
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageFooter
app.ActiveWindow.Selection.WholeStory
app.ActiveWindow.Selection.Copy
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument
Doc01.Close
Dim fileName = "d:\test.docx"
Dim doc As Object = app.Documents.Open(fileName)
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageHeader
app.ActiveWindow.Selection.WholeStory
app.ActiveWindow.Selection.TypeBackspace
app.ActiveWindow.Selection.Paste
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument
app.Visible = True
Dim doc1 As Object = app.Documents.Open(fileName)
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageFooter
app.ActiveWindow.Selection.WholeStory
app.ActiveWindow.Selection.TypeBackspace
app.ActiveWindow.Selection.Paste
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument
app.Visible = True
catch ex As exception
msgbox(ex.message)
app.Quit
finally
'app.Quit
End try
这样运行的话 结果页眉页脚都是页脚的内容了 老师怎么修正呢?