Get Started
Documentation

GetRange

GetRange(sRange) → {ApiRange}

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:

Name Type Description
sRange string The range of cells from the current sheet.

Returns:

Type
ApiRange

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A2").SetValue("2"); 
var sRange = oWorksheet.GetRange("A1:D5");
sRange.SetAlignHorizontal("center");
builder.SaveFile("xlsx", "SetAlignHorizontal.xlsx");
builder.CloseFile();

Resulting document