跳到主要内容

SetHighlight

指定应用于当前段落内容背景的高亮颜色。

语法

expression.SetHighlight(sColor);

expression - 表示 ApiParagraph 类的变量。

参数

名称必需/可选数据类型默认值描述
sColor必需highlightColor可用的突出显示颜色。

返回值

ApiParagraph

示例

此示例为段落设置「浅灰色」高亮颜色。

// How to set highlight to the text.

// Create a new paragraph and highlight it.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is a paragraph with the text highlighted with light gray color.");
paragraph.SetHighlight("lightGray");