Skip to content
本页内容

Borders (属性)

返回一个 Borders 集合,该集合在条件格式规则的计算结果为 True 时指定单元格边框的格式。只读。

说明

对于条件格式对象,您只能为单元格的上边框、下边框和侧边框设置属性。

示例

python
#此示例将工作表 Sheet1 中区域 C1:C10 的第一个(UniqueValues)条件格式的右边框设置为蓝色虚线
def test():
    uniqueValues = Application.Worksheets.Item("Sheet1").Range("C1:C10").FormatConditions.Item(1)
    boder = uniqueValues.Borders.Item(xlEdgeRight)
    boder.LineStyle = xlDash
    boder.Color = RGB(0, 0, 255)
python
#本示例设置活动工作表上区域 C1:C10 中第二个条件格式边框的线条样式
def test():
    uniqueValues = ActiveSheet.Range("C1:C10").FormatConditions.Item(2)
    boders = uniqueValues.Borders
    boders.LineStyle = xlfloat