SetStyle
Sets the style to the current Range.
Syntax
expression.SetStyle(oStyle);
expression
- A variable that represents a ApiRange class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
oStyle | Required | ApiStyle | The style which must be applied to the text character. |
Returns
ApiRange | null
Example
This example sets the style to the current Range.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
let range = doc.GetRange(0, 26);
let style = doc.GetStyle("Heading 2");
range.SetStyle(style);