[]
        
(Showing Draft Content)

IPivotLineCells

Interface IPivotLineCells

All Superinterfaces:
Iterable<IPivotCell>

public interface IPivotLineCells extends Iterable<IPivotCell>
Represents the collection of IPivotCell objects in a specific IPivotLine.

 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 Summary

    Modifier and Type
    Method
    Description
    get(int index)
    Returns the IPivotCell at the specified index in this collection.
    int
    Returns the number of items in the PivotLineCells collection.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • getCount

      int getCount()
      Returns the number of items in the PivotLineCells collection.
      
       IPivotLine pivotLine = pivotTable.getPivotRowAxis().getPivotLines().get(0);
       IPivotLineCells cells = pivotLine.getPivotLineCells();
       int count = cells.getCount();
       
      Returns:
      The number of items in the PivotLineCells collection.
    • get

      IPivotCell get(int index)
      Returns the IPivotCell at the specified index in this collection.
      
       IPivotLine pivotLine = pivotTable.getPivotRowAxis().getPivotLines().get(0);
       IPivotLineCells cells = pivotLine.getPivotLineCells();
       IPivotCell firstCell = cells.get(0);
       
      Parameters:
      index - The zero-based index of the pivot cell.
      Returns:
      The IPivotCell at the specified index.