SetHighlight
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.
Syntax
expression.SetHighlight(sColor);
expression - A variable that represents a ApiTextPr class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| sColor | Required | highlightColor | Available highlight color. |
Returns
Example
Apply a background highlight color to text in a document.
// How do I mark text with a colored background in a document?
// Draw attention to specific words by painting a highlight behind them in a document.
let doc = Api.GetDocument();
let textPr = doc.GetDefaultTextPr();
textPr.SetHighlight("lightGray");
let paragraph = doc.GetElement(0);
paragraph.AddText("A sample text highlighted with light gray color using the text properties.");