Sub 文档格式化()
'
Dim i As Paragraph
Application.ScreenUpdating = False
For Each i In ActiveDocument.Paragraphs
If i.Range Like "第*类*" = True Then
i.Style = wdStyleHeading1 '标题 1 是以 第*类 开头的段落
ElseIf i.Range Like "第*章*" = True Then
i.Style = wdStyleHeading1 '标题 1 是以 第*章 开头的段落
ElseIf i.Range Like "二+二*" = True Then
i.Style = wdStyleHeading2 '标题 2 是以 二+二 开头的段落
ElseIf i.Range Like "四+二*" = True Then
i.Style = wdStyleHeading3 '标题 3 是以 四+二 开头的段落
Else
i.Style = wdStyleNormal '其它为正文样式
End If
Next
Application.ScreenUpdating = True
End Sub
Sub 统一报告表格样式()
Dim i As Integer '定义变量
Dim doc As Document, myTable As Table '定义图表变量
For i = 1 To ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Style = "网格表 4"
Next
Set doc = ActiveDocument
If doc.Tables.Count = 0 Then Exit Sub
For Each myTable In doc.Tables
myTable.Range.Rows.Alignment = wdAlignRowCenter
Next
End Sub