我正在使用Office Word Com构建word文档,我在页眉中添加了页码 但我需要分页格式如下:
目前唯一的数字: 10
我想成为:
10从11
我想添加字体格式(粗体,字体名,字体大小) 这是代码:
Sub addnumber(ByRef oWordDoc As Word.Document)
oWordDoc.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader
oWordDoc.ActiveWindow.ActivePane.Selection.Paragraphs.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
Dim CurrentPage As Object = Word.WdFieldType.wdFieldNumPages
oWordDoc.ActiveWindow.Selection.Fields.Add(oWordDoc.ActiveWindow.Selection.Range, CurrentPage, Type.Missing)
End Sub
答案 0 :(得分:1)
检查以下代码:
oWordDoc.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader
oWordDoc.ActiveWindow.ActivePane.Selection.Paragraphs.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
Dim CurrentPage As Object = Word.WdFieldType.wdFieldNumPages
Dim CurrentPage1 As Object = Word.WdFieldType.wdFieldPage
Dim format As Object = True
oWordDoc.ActiveWindow.Selection.Range.Bold = True
oWordDoc.ActiveWindow.Selection.Range.Font.Name = "Arial"
oWordDoc.ActiveWindow.Selection.Range.Font.Size = 10
oWordDoc.ActiveWindow.Selection.Fields.Add(oWordDoc.ActiveWindow.Selection.Range, CurrentPage, Type.Missing, format)
oWordDoc.ActiveWindow.Selection.TypeText(" from ")
oWordDoc.ActiveWindow.Selection.Fields.Add(oWordDoc.ActiveWindow.Selection.Range, CurrentPage1, Type.Missing, format)