[]
Serializable, Comparable<LayoutRowType>, Constable将此枚举与 IPivotTable.setRowAxisLayout(LayoutRowType) 一起使用,可更改数据透视表行轴的显示布局。默认布局为 CompactRow。
注意:如果布局设置为 TabularRow,则 SubtotalLocationType 只能设置为 SubtotalLocationType.Bottom。
Object sourceData = new Object[][] {
{"Order ID", "Product", "Category", "Amount"},
{1, "Bose 785593-0050", "Consumer Electronics", 4270},
{2, "Canon EOS 1500D", "Consumer Electronics", 8239},
{3, "Iphone XR", "Mobile", 9062}
};
worksheet.getRange("A1:D4").setValue(sourceData);
IPivotCache pivotcache = workbook.getPivotCaches().create(worksheet.getRange("A1:D4"));
IPivotTable pivottable = worksheet.getPivotTables().add(pivotcache, worksheet.getRange("A6"), "pivottable1");
pivottable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
pivottable.getPivotFields().get("Product").setOrientation(PivotFieldOrientation.RowField);
pivottable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
pivottable.setRowAxisLayout(LayoutRowType.TabularRow);
Enum.EnumDesc<E extends Enum<E>>static LayoutRowTypeforValue(int value) intgetValue()static LayoutRowTypestatic LayoutRowType[]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 nullvalue - The ordinal value.