返回或设置指定对象的边框格式。如果指定对象的全部或部分边框应用了边框格式,则返回值为 True 或 wdUndefined。可将该属性设置为 True、False 或 WdLineStyle 常量。Long 类型,可读写。
Enable 属性应用于指定对象的所有边框。如果该属性值为 True,则将线型设置为默认线型,将线条宽度设置为默认线条宽度。可以通过 DefaultBorderLineWidth 及 DefaultBorderLineStyle 属性来设置默认线型和默认线条宽度。
正如下例所示,将 Enable 属性的值设置为 False,就可以删除对象中的所有边框。
ActiveDocument.Tables(1).Borders.Enable = False
如果要设置或删除边框某一单边,则可先用 Borders(index) 返回单一边框,再设置 LineStyle 属性(其中 index 为 WdBorderType 常量)。下例删除 rngTemp
中的边框底边。
Dim rngTemp
rngTemp.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
本示例用于删除表格 1 中第一个单元格的所有边框。
If ActiveDocument.Tables.Count >= 1 Then
ActiveDocument.Tables(1).Cell(1, 1).Borders.Enable = False
End If
本示例为选定部分第一段四边设置虚框。
Options.DefaultBorderLineWidth = wdLineWidth025pt
Selection.Paragraphs(1).Borders.Enable = _
wdLineStyleDashSmallGap
本示例为所选内容的第一个字符设置边框。如果没有选定内容,则为插入点后的第一个字符设置边框。
Selection.Characters(1).Borders.Enable = True