[]
Represents a collection of all IPivotItem objects in a PivotTable field.
Each item in the collection corresponds to an individual data entry in the field category. Use this interface to access pivot items returned by PivotItems, and then retrieve a specific item by index or name.
public interface IPivotItems : IEnumerable<IPivotItem>, IEnumerable
Public Interface IPivotItems
Inherits IEnumerable(Of IPivotItem), IEnumerable
object[,] sourceData = {
{"Region", "Amount"},
{"North", 100},
{"South", 200},
{"East", 150}
};
worksheet.Range["A1:B4"].Value = sourceData;
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;
IPivotItems items = field.PivotItems;
items["North"].Visible = false;
| Name | Description |
|---|---|
| Count | 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. |
| this[int] | Returns the IPivotItem at the specified index in the collection. Use this property to retrieve a pivot item from the IPivotItems collection associated with a pivot field when you know its position. |
| this[string] | Returns the IPivotItem with the specified name from the collection. Use this property to retrieve a pivot item from the IPivotItems collection associated with a pivot field. |