[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotItemList.Count

Count Property

Count

Gets the number of pivot items in this list.

This property returns the number of IPivotItem objects contained in the current IPivotItemList.

Declaration
int Count { get; }
ReadOnly Property Count As Integer
Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Category", "Product", "Amount"},
    {"Fruit", "Apple", 100},
    {"Fruit", "Orange", 200},
    {"Vegetable", "Carrot", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "pivotTable1");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotValueCell valueCell = pivotTable.PivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.PivotCell;
IPivotItemList rowItems = pivotCell.RowItems;
int count = rowItems.Count;