[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
立即试用
(Showing Draft Content)

PivotLineType

Enum Class PivotLineType

java.lang.Object
java.lang.Enum<PivotLineType>
com.grapecity.documents.excel.PivotLineType
All Implemented Interfaces:
Serializable, Comparable<PivotLineType>, Constable

public enum PivotLineType extends Enum<PivotLineType>
指定数据透视线的类型。

将此枚举与 IPivotLine.getLineType() 一起使用,可以确定数据透视线是常规项数据透视线、小计数据透视线、总计数据透视线还是空白分隔数据透视线。


 worksheet.getRange("A1:B4").setValue(new Object[][] {
     {"Category", "Amount"},
     {"Fruit", 100},
     {"Fruit", 200},
     {"Vegetable", 50}
 });
 IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
 IWorksheet pivotSheet = workbook.getWorksheets().add();
 IPivotTable pivotTable = pivotSheet.getPivotTables().add(pivotCache, pivotSheet.getRange("A1"), "SalesPivot");
 pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
 pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
 pivotTable.update();
 
 IPivotLine line = pivotTable.getPivotRowAxis().getPivotLines().get(0);
 if (line.getLineType() == PivotLineType.Regular) {
     IPivotLineCells cells = line.getPivotLineCells();
 }
 
  • Enum Constant Details

    • Regular

      public static final PivotLineType Regular
      包含数据透视项的常规数据透视线。
    • Subtotal

      public static final PivotLineType Subtotal
      显示组小计值的数据透视线。
    • GrandTotal

      public static final PivotLineType GrandTotal
      显示总计值的数据透视线。
    • Blank

      public static final PivotLineType Blank
      在每个组后插入的空白数据透视线。
  • Method Details

    • values

      public static PivotLineType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PivotLineType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null