[]
Gets the number of IPivotItem objects in the collection.
When this collection is returned by PivotItems, the count includes the items in that PivotTable field.
int Count { get; }
ReadOnly Property Count As Integer
worksheet.Range["A1:B4"].Value = new object[,] {
{"Region", "Amount"},
{"East", 100},
{"West", 200},
{"East", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
IPivotField field = pivotTable.PivotFields["Region"];
field.Orientation = PivotFieldOrientation.RowField;
int count = field.PivotItems.Count;