[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ICalculatedItems.Count

Count Property

Count

Returns the number of IPivotItem objects in the collection.

This value represents the total number of calculated items defined for the associated pivot field. Returns 0 if the collection does not contain any calculated items.

Declaration
int Count { get; }
ReadOnly Property Count As Integer
Examples
worksheet.Range["A1:B3"].Value = new object[,] {
    {"Region", "Amount"},
    {"North", 100},
    {"South", 200}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B3"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "PivotTable1");
pivotTable.PivotFields["Region"].Orientation = PivotFieldOrientation.RowField;
ICalculatedItems items = pivotTable.PivotFields["Region"].CalculatedItems();
items.Add("NorthAndSouth", "=Region[North]+Region[South]");
int count = items.Count;