跳到主要内容

GetItem

Returns a single object from a collection by its ID.

Syntax

expression.GetItem(ind);

expression - A variable that represents a ApiAreas class.

Parameters

NameRequired/OptionalData typeDefaultDescription
indRequirednumberThe index number of the object.

Returns

ApiRange

Example

This example shows how to get a single object from a collection by its ID.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("B1:D1");
range.SetValue("1");
range.Select();
let areas = range.GetAreas();
let item = areas.GetItem(1);
range = worksheet.GetRange('A5');
range.SetValue("The first item from the areas: ");
range.AutoFit(false, true);
worksheet.GetRange('B5').Paste(item);