SetHighlight

SetHighlight(sColor) → { ApiTextPr }

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:

Name Type Description
sColor highlightColor

Available highlight color.

Returns:

Type
ApiTextPr

Example

Copy code
builder.CreateFile("docx");
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.");
builder.SaveFile("docx", "SetHighlight.docx");
builder.CloseFile();

Resulting document