GetRange
function GetRange(Start: Number = 0, End: Number = -1): ApiRange
Description
Returns a Range object that represents the document part contained in the specified range.
Parameters
- Start
Number
0 Start character index in the current range.
- End
Number
-1 End character index in the current range (if <= 0, then the range is taken to the end).
Returns
ApiRange
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
var oRange1 = oDocument.GetRange(0, 24);
oRange1.SetBold(true);
var oRange2 = oRange1.GetRange(0, 9);
oRange2.SetItalic(true);