[]
Serializable, Comparable<SubtotalLocationType>, Constable使用 Top 可将小计放置在相关字段项上方,使用 Bottom 可将小计放置在相关字段项下方。与 IPivotTable.subtotalLocation(SubtotalLocationType) 一起使用时,如果需要 Bottom,则数据透视表行布局必须为 LayoutRowType.TabularRow。
worksheet.getRange("A1:B5").setValue(new Object[][] {
{"Product", "Amount"},
{"A", 100},
{"A", 200},
{"B", 300},
{"B", 400}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B5"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
pivotTable.getPivotFields().get("Product").setOrientation(PivotFieldOrientation.RowField);
pivotTable.subtotalLocation(SubtotalLocationType.Top);
Enum.EnumDesc<E extends Enum<E>>static SubtotalLocationTypestatic SubtotalLocationType[]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