Sub 文档格式标准化() ' 全选文档 Selection.WholeStory ' ===================== 页面设置 ===================== With ActiveDocument.PageSetup .TopMargin = CentimetersToPoints(3) .BottomMargin = CentimetersToPoints(3) .LeftMargin = CentimetersToPoints(3) .RightMargin = CentimetersToPoints(3) .Gutter = CentimetersToPoints(1) .HeaderDistance = CentimetersToPoints(2) .FooterDistance = CentimetersToPoints(2) .SectionStart = wdSectionNewPage .OddAndEvenPagesHeaderFooter = True .DifferentFirstPageHeaderFooter = True .MirrorMargins = False .CharsLine = 22 .LinesPage = 28 .LayoutMode = wdLayoutModeGrid End With ' ===================== 总标题(wdStyleTitle) ===================== With ActiveDocument.Styles(wdStyleTitle).Font .NameFarEast = "黑体" .NameAscii = "Times New Roman" .Size = 22 .Bold = True End With With ActiveDocument.Styles(wdStyleTitle).ParagraphFormat .SpaceBefore = 0 .SpaceAfter = 0 .LineSpacingRule = wdLineSpaceDouble .Alignment = wdAlignParagraphCenter .OutlineLevel = wdOutlineLevel1 End With ' ===================== 一级标题(wdStyleHeading1) ===================== With ActiveDocument.Styles(wdStyleHeading1).Font .NameFarEast = "黑体" .NameAscii = "Times New Roman" .Size = 22 .Bold = True End With With ActiveDocument.Styles(wdStyleHeading1).ParagraphFormat .SpaceBefore = 0 .SpaceAfter = 0 .LineSpacingRule = wdLineSpaceDouble .Alignment = wdAlignParagraphCenter .OutlineLevel = wdOutlineLevel1 End With ' ===================== 二级标题(wdStyleHeading2) ===================== With ActiveDocument.Styles(wdStyleHeading2).Font .NameFarEast = "黑体" .NameAscii = "Times New Roman" .Size = 20 .Bold = True End With With ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat .SpaceBefore = 0 .SpaceAfter = 0 .LineSpacingRule = wdLineSpaceDouble .Alignment = wdAlignParagraphCenter .OutlineLevel = wdOutlineLevel2 End With ' ===================== 三级标题(wdStyleHeading3) ===================== With ActiveDocument.Styles(wdStyleHeading3).Font .NameFarEast = "黑体" .NameAscii = "Times New Roman" .Size = 18 .Bold = True End With With ActiveDocument.Styles(wdStyleHeading3).ParagraphFormat .SpaceBefore = 0 .SpaceAfter = 0 .LineSpacingRule = wdLineSpaceDouble .Alignment = wdAlignParagraphLeft .OutlineLevel = wdOutlineLevel3 End With ' ===================== 样式基础设置 ===================== With ActiveDocument.Styles(wdStyleTitle) .AutomaticallyUpdate = False .BaseStyle = "" .NextParagraphStyle = wdStyleNormal End With With ActiveDocument.Styles(wdStyleHeading1) .AutomaticallyUpdate = False .BaseStyle = "" .NextParagraphStyle = wdStyleNormal End With With ActiveDocument.Styles(wdStyleHeading2) .AutomaticallyUpdate = False .BaseStyle = "" .NextParagraphStyle = wdStyleNormal End With With ActiveDocument.Styles(wdStyleHeading3) .AutomaticallyUpdate = False .BaseStyle = "" .NextParagraphStyle = wdStyleNormal End With End Sub常用内置样式表
wdStyleTitle ' 总标题 wdStyleHeading1 ' 一级标题 wdStyleHeading2 ' 二级标题 wdStyleHeading3 ' 三级标题 wdStyleNormal ' 正文 wdStyleCaption ' 图片说明、表格标题(题注) wdStyleHeader ' 页眉 wdStyleFooter ' 页脚