[]
Iterable<IPivotLine>Each IPivotLine in this collection corresponds to a row or column line in the PivotTable report and contains a set of PivotCells. Use this interface to access the lines returned by IPivotAxis.getPivotLines() and to enumerate or retrieve individual pivot lines by position.
worksheet.getRange("A1:C5").setValue(new Object[][] {
{"Category", "Product", "Amount"},
{"Fruit", "Apple", 100},
{"Fruit", "Orange", 200},
{"Drink", "Tea", 150},
{"Drink", "Coffee", 120}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C5"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
IPivotLines pivotLines = pivotTable.getPivotRowAxis().getPivotLines();
IPivotLine firstLine = pivotLines.get(0);
get(int index) IPivotLine at the specified position in this collection.intgetCount()forEach, iterator, spliteratorThis collection contains the row or column pivot lines associated with a pivot axis, such as the collection returned by IPivotAxis.getPivotLines().
Object[][] sourceData = new Object[][] {
{"Product", "Category", "Amount"},
{"Apple", "Fruit", 100},
{"Pear", "Fruit", 80},
{"Desk", "Office", 120}
};
worksheet.getRange("A1:C4").setValue(sourceData);
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);
int count = pivotTable.getPivotRowAxis().getPivotLines().getCount();
IPivotLine at the specified position in this collection.Use this method to retrieve a row-axis or column-axis pivot line by its zero-based index from the collection returned by IPivotAxis.getPivotLines().
worksheet.getRange("A1:C5").setValue(new Object[][] {
{"Category", "Product", "Amount"},
{"Fruit", "Apple", 100},
{"Fruit", "Orange", 200},
{"Drink", "Tea", 150},
{"Drink", "Coffee", 120}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C5"));
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);
index - The zero-based position of the pivot line in this collection.IPivotLine at the specified position.