跳到主要内容

GetRange

Returns the ApiRange object by the range reference.

Syntax

expression.GetRange(sRange);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sRangeRequiredstringThe range of cells from the current sheet.

Returns

ApiRange

Example

This example shows how to get the ApiRange object by the range reference.

let worksheet = Api.GetActiveSheet();
let range = Api.GetRange("A1:C1");
range.SetFillColor(Api.CreateColorFromRGB(255, 213, 191));
worksheet.GetRange("A3").SetValue("The color was set to the background of cells A1:C1.");