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

语法

表达式.SmallCaps

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

说明

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

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

示例

本示例区分新文档中小型大写字母和全部大写字母之间的差别。

示例代码
let myRange = Documents.Add().Content
    myRange.InsertAfter("This is a demonstration of SmallCaps.")
    myRange.Words.Item(6).Font.SmallCaps = true
    myRange.InsertParagraphAfter()
    myRange.InsertAfter("This is a demonstration of AllCaps.")
    myRange.Words.Item(14).Font.AllCaps = true

如果部分选定内容中的字体格式已设置为小型大写字母格式,本示例将整个选定内容的字体格式设置为小型大写字母格式。

示例代码
if(Selection.Type == wdSelectionNormal) { 
    let mySel = Selection.Font.SmallCaps
    if(mySel == wdUndefined) {
        Selection.Font.SmallCaps = true
    }
}
else {
    MsgBox("You need to select some text.")
}


请参阅