WPS 加载项开发 > 文字 API 参考 > Range > 属性 > Range.Font 属性
返回或设置 Font 对象,该对象代表指定对象的字符格式。Font 类型,可读写。

语法

表达式.Font

表达式   一个代表 Range 对象的变量。

说明

要设置该属性,需指定一个返回 Font 对象的表达式。

示例

本示例将取消活动文档的“标题 1”样式中的加粗格式。

示例代码
ActiveDocument.Styles.Item(wdStyleHeading1).Font.Bold = false

本示例在 Arial 和 Times New Roman 之间切换活动文档中第二段的字体。

示例代码
let myRange = ActiveDocument.Paragraphs.Item(2).Range
if(myRange.Font.Name == "Times New Roman"){
    myRange.Font.Name = "Arial"
}
else{
    myRange.Font.Name = "Times New Roman"
}


请参阅