首页 > 代码库 > word 批量修改表格格式

word 批量修改表格格式

For i = 1 To ActiveDocument.Tables.Count ActiveDocument.Tables(i).Cell(1, 1).Select With Selection .SelectRow .Font.Bold = True .Shading.BackgroundPatternColor = -603923969End With ActiveDocument.Tables(i).Range.Font.Size = 10 Next

  宏内容:修改表格第一行字体为粗体,背景为浅灰色

For i = 1 To ActiveDocument.Tables.Count ActiveDocument.Tables(i).Style = "my"Next

  宏内容:修改文档中所有的表格,使其表格样式为“my”的样式格式。

For i = 1 To ActiveDocument.Tables.Count ActiveDocument.Tables(i).Style = "my"With With ActiveDocument.Tables(i).Range.ParagraphFormat       .SpaceBeforeAuto = False        .SpaceAfterAuto = False        .LineSpacingRule = wdLineSpace1pt5        .Alignment = wdAlignParagraphCenter        .WidowControl = False        .KeepWithNext = False        .KeepTogether = False        .PageBreakBefore = False        .NoLineNumber = False        .Hyphenation = True        .FirstLineIndent = CentimetersToPoints(0)        .OutlineLevel = wdOutlineLevelBodyText        .CharacterUnitLeftIndent = 0        .CharacterUnitRightIndent = 0        .CharacterUnitFirstLineIndent = 0        .MirrorIndents = False        .TextboxTightWrap = wdTightNone        .CollapsedByDefault = False        .AutoAdjustRightIndent = True        .DisableLineHeightGrid = False        .FarEastLineBreakControl = True        .WordWrap = True        .HangingPunctuation = True        .HalfWidthPunctuationOnTopOfLine = False        .AddSpaceBetweenFarEastAndAlpha = True        .AddSpaceBetweenFarEastAndDigit = True        .BaseLineAlignment = wdBaselineAlignAuto        End With Next

宏内容:修改表格段落格式

word 批量修改表格格式