1

我使用 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
4

1 回答 1

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)
于 2012-11-29T06:53:38.843 回答