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();