WPS 基础接口 > 文字 API 参考 > Font > 属性 > Font.Subscript 属性
如果字体格式为下标,则该属性值为 TrueLong 类型,可读写。

语法

表达式.Subscript

表达式   返回 Font 对象的表达式。

说明

返回 TrueFalsewdUndefined(当返回值既可为 True,也可为 False 时取该值)。可设置为 TrueFalsewdToggle

如果将 Subscript 属性设为 True,则 Superscript 属性会设为 False,反之亦然。

示例

本示例在活动文档的开头插入文本,并将第十个字符设为下标。

示例代码
let myRange = ActiveDocument.Range(0, 0)
myRange.InsertAfter("Water = H20")
myRange.Characters.Item(10).Font.Subscript = true

本示例检查所选文本的下标格式。

示例代码
if(Selection.Type == wdSelectionNormal){
    let mySel = Selection.Font.Subscript
    if(mySel == wdUndefined || mySel == true){
        MsgBox("Subscript text exists in the selection.")
    }
    else{
        MsgBox("No subscript text in the selection.")
    }
}
else{
    MsgBox("You need to select some text.")
}


请参阅