CreateRange
function CreateRange(oElement: any = null, nStart: any = null, nEnd: any = null): ApiRange | "null"
Description
Creates an element range. If you do not specify the start and end positions, the range will be taken from the entire element.
Parameters
- oElement
any
null The element from which the range will be taken.
- nStart
any
null Start range position.
- nEnd
any
null End range position.
Returns
ApiRange | "null"
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
var oRange = Api.CreateRange(oParagraph, 0, 9);
oRange.SetBold(true);