[]
Iterable<IPivotItem>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 IPivotField.getPivotItems(), and then retrieve a specific item by index or name.
Object[][] sourceData = {
{"Region", "Amount"},
{"North", 100},
{"South", 200},
{"East", 150}
};
worksheet.getRange("A1:B4").setValue(sourceData);
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "salesPivot");
IPivotField field = pivotTable.getPivotFields().get("Region");
field.setOrientation(PivotFieldOrientation.RowField);
IPivotItems items = field.getPivotItems();
items.get("North").setVisible(false);
get(int index) IPivotItem at the specified index in the collection.IPivotItem with the specified name from the collection.intgetCount()IPivotItem objects in the collection.forEach, iterator, spliteratorIPivotItem objects in the collection.When this collection is returned by IPivotField.getPivotItems(), the count includes the items in that PivotTable field.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Region", "Amount"},
{"East", 100},
{"West", 200},
{"East", 150}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
IPivotField field = pivotTable.getPivotFields().get("Region");
field.setOrientation(PivotFieldOrientation.RowField);
int count = field.getPivotItems().getCount();
IPivotItem objects in the collection.IPivotItem at the specified index in the collection.Use this method to retrieve a pivot item from the IPivotItems collection associated with a pivot field.
Object[][] sourceData = {
{"Category", "Product", "Amount"},
{"Beverages", "Tea", 10},
{"Beverages", "Coffee", 20},
{"Snacks", "Cookie", 15}
};
worksheet.getRange("A1:C4").setValue(sourceData);
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
IPivotField field = pivotTable.getPivotFields().get("Product");
field.setOrientation(PivotFieldOrientation.RowField);
IPivotItem item = field.getPivotItems().get(0);
String name = item.getName();
index - The zero-based index of the pivot item to return.IPivotItem at the specified index.IPivotItem with the specified name from the collection.Use this method to retrieve a pivot item from the IPivotItems collection associated with a pivot field.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Product", "Amount"},
{"Apple", 100},
{"Banana", 80},
{"Apple", 120}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
IPivotField field = pivotTable.getPivotFields().get("Product");
field.setOrientation(PivotFieldOrientation.RowField);
IPivotItem item = field.getPivotItems().get("Apple");
name - The name of the pivot item to return.IPivotItem with the specified name.