Get Started
Documentation

SetHighlight

SetHighlight(r, g, b, [isNone]) → { ApiParagraph }

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

Parameters:

Name Type Default Description
r byte

Red color component value.

g byte

Green color component value.

b byte

Blue color component value.

isNone boolean false

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

Returns:

Type
ApiParagraph

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is a paragraph with the text highlighted with yellow color.");
oParagraph.SetHighlight(255, 255, 0);
builder.SaveFile("docx", "SetHighlight.docx");
builder.CloseFile();