TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

GetCount

GetCount() → { number }

Returns a value that represents the number of objects in the collection.

Parameters:

This method doesn't have any parameters.

Returns:

Type
number

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oRange = oWorksheet.GetRange("B1:D1");
oRange.SetValue("1");
oRange.Select();
var oAreas = oRange.GetAreas();
var nCount = oAreas.GetCount();
oRange = oWorksheet.GetRange('A5');
oRange.SetValue("The number of ranges in the areas: ");
oRange.AutoFit(false, true);
oWorksheet.GetRange('B5').SetValue(nCount);
builder.SaveFile("xlsx", "GetCount.xlsx");
builder.CloseFile();

Resulting document