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

IPivotLineCells

Interface IPivotLineCells

All Superinterfaces:
Iterable<IPivotCell>

public interface IPivotLineCells extends Iterable<IPivotCell>
表示特定 IPivotLine 中的 IPivotCell 对象集合。

 worksheet.getRange("A1:C4").setValue(new Object[][] {
     {"Category", "Product", "Amount"},
     {"Fruit", "Apple", 100},
     {"Fruit", "Orange", 200},
     {"Vegetable", "Carrot", 150}
 });
 IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
 IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
 pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
 pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
 IPivotLine pivotLine = pivotTable.getPivotRowAxis().getPivotLines().get(0);
 IPivotLineCells cells = pivotLine.getPivotLineCells();
 int count = cells.getCount();
 
  • Method Details

    • getCount

      int getCount()
      返回 PivotLineCells 集合中的项数。
      
       IPivotLine pivotLine = pivotTable.getPivotRowAxis().getPivotLines().get(0);
       IPivotLineCells cells = pivotLine.getPivotLineCells();
       int count = cells.getCount();
       
      Returns:
      PivotLineCells 集合中的项数。
    • get

      IPivotCell get(int index)
      返回集合中指定索引处的 IPivotCell。
      
       IPivotLine pivotLine = pivotTable.getPivotRowAxis().getPivotLines().get(0);
       IPivotLineCells cells = pivotLine.getPivotLineCells();
       IPivotCell firstCell = cells.get(0);
       
      Parameters:
      index - 数据透视单元格从 0 开始的索引。
      Returns:
      指定索引处的 IPivotCell。