[]
Gets the number of pivot items in this list.
This property returns the number of IPivotItem objects contained in the current IPivotItemList.
int Count { get; }
ReadOnly Property Count As Integer
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;