Get Started
Documentation

SetHighlight

SetHighlight(r, g, b, [isNone]) → { ApiRange | null }

Specify a highlighting color in the RGB format which is applied as a background for the contents of the current Range.

Parameters:

Name Type Default Description
r byte

Red color component value.

g byte

Green color component value.

b byte

Blue color component value.

isNone bool false

If this parameter is set to "true", then r,g,b parameters will be ignored.

Returns:

Type
ApiRange | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
oRange = oDocument.GetRange(0, 26);
oRange.SetHighlight(255, 164, 101);
builder.SaveFile("docx", "SetHighlight.docx");
builder.CloseFile();