Skip to content
本页内容

Underline (属性)

返回或设置应用于字体的下划线类型。可为以下 XlUnderlineStyle常量之一。Any 类型,可读写。

说明

XlUnderlineStyle 可为以下 XlUnderlineStyle 常量之一。
xlUnderlineStyleNone
xlUnderlineStyleSingle
xlUnderlineStylefloat
xlUnderlineStyleSingleAccounting
xlUnderlineStylefloatAccounting

示例

python
#本示例将 Sheet1 中活动单元格的字体设置为单下划线
def test():
    Application.Worksheets.Item("Sheet1").Activate()
    Application.ActiveCell.Font.Underline = xlUnderlineStyleSingle
python
#本示例显示第一个工作表中单元格A6的字体的下划线类型是否为粗双下划线
def test():
    font = Application.Worksheets.Item(1).Range("A6").Font
    print(font.Underline == xlUnderlineStylefloat)

``