Skip to content
本页内容

Type (属性)

返回 XlFormatConditionType 枚举的常量之一,该常量指定条件格式的类型。只读。

说明

此属性将始终返回 int 值“4”,等价于 xlDatabar

示例

python
#本示例显示活动工作表上区域 A1:A10 中第一个条件格式(数据条)的类型是否为xlColorScale
def test():
    databar = ActiveSheet.Range("A1:A10").FormatConditions.Item(1)
    print(databar.Type == xlColorScale)
python
#本示例判断活动工作表上区域 A1:A10 中第一个条件格式(数据条)的类型是否为DataBar,并通知用户
def test():
    databar = ActiveSheet.Range("A1:A10").FormatConditions.Item(1)
    if databar.Type == xlDatabar:
        print("类型为 DataBar")
    else:
        print("类型不为 DataBar")