GetRange

function GetRange(Range1: string | ApiRange = null, Range2: string | ApiRange = null): ApiRange | "null"

Description

Returns an object that represents the selected range of the current sheet. Can be a single cell - A1, or cells from a single row - A1:E1, or cells from a single column - A1:A10, or cells from several rows and columns - A1:E10.

Parameters

Range1string | ApiRangedefault: null

The range of cells from the current sheet.

Range2string | ApiRangedefault: null

The range of cells from the current sheet.

Returns

ApiRange | "null"

Try It

var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A2").SetValue("2");
var oRange = oWorksheet.GetRange("A1:D5");
oRange.SetAlignHorizontal("center");

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).