[]
Gets the pivot item at the specified index in this list.
IPivotItem this[int field] { get; }
ReadOnly Default Property Item(field As Integer) As IPivotItem
| Type | Name | Description |
|---|---|---|
| int | field | The zero-based index in the pivot item list. |
worksheet.Range["G1:J4"].Value = new object[,] {
{"Category", "Product", "Amount", "Country"},
{"Fruit", "Apple", 100, "USA"},
{"Fruit", "Orange", 200, "USA"},
{"Vegetable", "Carrot", 150, "Canada"}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["G1:J4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["A1"], "pivotTable1");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotValueCell valueCell = pivotTable.PivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.PivotCell;
IPivotItem item = pivotCell.RowItems[0];