0
目前我編寫了一個加載項,它可以從下拉菜單中將值設置爲文檔的頁眉。它可以進入頁眉或頁腳,但是我的代碼目前都會覆蓋該部分的所有內容。當發送文檔或用戶嘗試使用模板時,這會造成問題。任何想法如何使代碼與目前在上面或下面的內容「合併」?VSTO Word 2010加載項VB.net
代碼段:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
On Error GoTo err
Dim classification As String
Dim dc As Microsoft.Office.Interop.Word.Document
dc = Globals.ThisAddIn.Application.ActiveDocument
classification = "Classification: " & ComboBox1.Text
With dc
.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader
.ActiveWindow.Selection.HeaderFooter.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
.ActiveWindow.Selection.HeaderFooter.Range.Text = classification
.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekMainDocument
End With
Me.Hide()
Exit Sub
只要你知道的代碼,你可以看到額外位被它搜索的分類目前不存在,如果是不顯示的形式(以下設置)。
感謝,
查爾斯