跳到主要内容

SetHighlight

Specifies a highlighting color which is applied as a background to the contents of the current Range.

Syntax

expression.SetHighlight(sColor);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sColorRequiredhighlightColorAvailable highlight color.

Returns

ApiRange | null

Example

This example specifies a highlighting color which is applied as a background to the contents of the Range.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
let range = doc.GetRange(0, 26);
range.SetHighlight("lightGray");