[]
Iterable<IPivotField>IPivotField objects in a PivotTable report.An IPivotFields collection contains all fields that belong to a PivotTable report, including fields that are not currently visible in the layout. Use this interface to enumerate fields or retrieve a field by index or by name.
worksheet.getRange("A1:C4").setValue(new Object[][] {
{"Product", "Region", "Amount"},
{"Apple", "East", 100},
{"Pear", "West", 200},
{"Apple", "West", 150}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
IPivotFields pivotFields = pivotTable.getPivotFields();
IPivotField amountField = pivotFields.get("Amount");
get(int index) IPivotField with the specified name from this collection.intgetCount()forEach, iterator, spliteratorThis method returns the total number of IPivotField objects available in the PivotTable field collection.
worksheet.getRange("A1:C4").setValue(new Object[][] {
{"Region", "Product", "Amount"},
{"East", "Apple", 120},
{"West", "Orange", 80},
{"East", "Orange", 90}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
int count = pivotTable.getPivotFields().getCount();
Use this method to retrieve a single IPivotField from the IPivotFields collection by position.
worksheet.getRange("A1:B5").setValue(new Object[][] {
{"Category", "Amount"},
{"Fruit", 120},
{"Fruit", 80},
{"Vegetables", 95},
{"Vegetables", 60}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B5"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
IPivotField field = pivotTable.getPivotFields().get(0);
field.setOrientation(PivotFieldOrientation.RowField);
index - The zero-based index of the pivot field to retrieve from the collection.IPivotField at the specified index.IndexOutOfBoundsException - if index is outside the valid range of the collection.IPivotField with the specified name from this collection.Use this method to retrieve a PivotTable field by its display name in the current IPivotFields collection.
worksheet.getRange("A1:C4").setValue(new Object[][] {
{"Region", "Product", "Amount"},
{"East", "Apple", 120},
{"West", "Apple", 80},
{"East", "Orange", 90}
});
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");
name - The name of the PivotTable field to retrieve. This value must match the field name in the collection.IPivotField with the specified name.IllegalArgumentException - if no field with the specified name exists in the collection.