TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

ApiAreas

new ApiAreas()

Class representing the areas.

Properties

Name Type Description
Count number

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

Parent ApiRange

Returns the parent object for the specified collection.

Methods

Name Description
GetCount

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

GetItem

Returns a single object from a collection by its ID.

GetParent

Returns the parent object for the specified collection.

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 oParent = oAreas.GetParent();
var sType = oParent.GetClassType();
oRange = oWorksheet.GetRange('A4');
oRange.SetValue("The areas parent: ");
oRange.AutoFit(false, true);
oWorksheet.GetRange('B4').Paste(oParent);
oRange = oWorksheet.GetRange('A5');
oRange.SetValue("The type of the areas parent: ");
oRange.AutoFit(false, true);
oWorksheet.GetRange('B5').SetValue(sType);
var nCount = oAreas.GetCount();
oRange = oWorksheet.GetRange('A6');
oRange.SetValue("The number of ranges in the areas: ");
oRange.AutoFit(false, true);
oWorksheet.GetRange('B6').SetValue(nCount);
var oItem = oAreas.GetItem(1);
oRange = oWorksheet.GetRange('A7');
oRange.SetValue("The first item from the areas: ");
oRange.AutoFit(false, true);
oWorksheet.GetRange('B7').Paste(oItem);
builder.SaveFile("xlsx", "ApiAreas.xlsx");
builder.CloseFile();

Resulting document