跳到主要内容

SetHighlight

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

语法

expression.SetHighlight(sColor);

expression - 表示 ApiParagraph 类的变量。

参数

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

返回值

ApiParagraph

示例

在文档中为段落设置 "lightGray" 突出显示颜色。

// How to set highlight to the text in a document.

// Create a new paragraph and highlight it in a document.

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");