[]
Represents an item in a PivotTable field.
An IPivotItem corresponds to a single item value in a IPivotField.
Use this interface to work with the item's name, source name, position, visibility,
expansion state, and calculated-item formula. Pivot items are obtained from the
IPivotItems collection of a pivot field.
public interface IPivotItem
Public Interface IPivotItem
worksheet.Range["A1:B4"].Value = new object[,] {
{"Category", "Amount"},
{"Beverages", 100},
{"Snacks", 200},
{"Beverages", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
IPivotField field = pivotTable.PivotFields["Category"];
field.Orientation = PivotFieldOrientation.RowField;
IPivotItem item = field.PivotItems[0];
item.Visible = false;
| Name | Description |
|---|---|
| Caption | Gets or sets the display caption override for the PivotItem. A |
| Formula | Gets or sets the formula of the calculated item. Use this property to retrieve the formula text defined for a calculated item in a PivotTable field. |
| Name | Gets or sets the name of the pivot item. |
| Position | Gets or sets the position of the pivot item within its parent field when the item is currently shown. This value indicates the displayed order of the item in the field. |
| ShowDetail | Gets or sets whether the pivot item is expanded so that its detail rows or columns are visible. This property returns the current outline state of the pivot item in its parent PivotTable field. |
| SourceName | Gets the name of this PivotTable item as it appears in the original source data. This value can differ from the current item name if the item was renamed after the PivotTable was created. |
| Visible | Gets or sets whether the pivot item is visible. |