[]
Serializable, Comparable<PivotFilterType>, Constable将此枚举与 IPivotFilters.add(PivotFilterType)、IPivotFilters.add(PivotFilterType,Object)、IPivotFilters.add(PivotFilterType,Object,Object) 或 IPivotFilters.add(PivotFilterType,Object,Object,PivotFilterOptions) 配合使用,可为数据透视表字段创建标签、值、日期以及顶部或底部筛选器。
示例:
worksheet.getRange("A1:C5").setValue(new Object[][] {
{"Product", "Category", "Amount"},
{"Example Speaker", "Audio", 4270},
{"Example Camera", "Camera", 8239},
{"Example TV", "TV", 2626},
{"Example Phone", "Mobile", 2417}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C5"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "PivotTable1");
IPivotField productField = pivotTable.getPivotFields().get("Product");
IPivotField amountField = pivotTable.getPivotFields().get("Amount");
productField.setOrientation(PivotFieldOrientation.RowField);
amountField.setOrientation(PivotFieldOrientation.DataField);
productField.getPivotFilters().add(PivotFilterType.CaptionBeginsWith, "Example");
Enum.EnumDesc<E extends Enum<E>>static PivotFilterTypeforValue(int value) intgetValue()static PivotFilterTypestatic PivotFilterType[]values()name - the name of the enum constant to be returned.IllegalArgumentException - if this enum class has no constant with the specified nameNullPointerException - if the argument is null