SetHighlight

function SetHighlight(sColor: any = null): void

Description

Specifies a highlighting color which is added to the text properties and applied as a background to the contents of the current run/range/paragraph.

Parameters

sColoranydefault: null

Available highlight color.

Returns

void

Overloads By

SetHighlight(sColor): ApiTextPr

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

Try It

var oDocument = Api.GetDocument();
var oTextPr = oDocument.GetDefaultTextPr();
oTextPr.SetHighlight("lightGray");
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("A sample text highlighted with light gray color using the text properties.");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).