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

StartNumberdefault: 0

Start character index in the current range.

EndNumberdefault: -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);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).