[]
An IPivotAxis represents either the row axis or the column axis of a IPivotTable. Use it to access the IPivotLines attached to that axis.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Category", "Amount"},
{"Fruit", 100},
{"Fruit", 200},
{"Vegetables", 150}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
IPivotAxis pivotAxis = pivotTable.getPivotRowAxis();
IPivotLines pivotLines = pivotAxis.getPivotLines();
IPivotLines collection attached to this pivot axis.The returned collection contains all pivot lines on the current axis. For a row axis, each pivot line represents a row in the pivot table axis area. For a column axis, each pivot line represents a column in the pivot table axis area.
Object[][] sourceData = new Object[][] {
{"Category", "Product", "Amount"},
{"Beverages", "Tea", 100},
{"Beverages", "Coffee", 200},
{"Snacks", "Chips", 50}
};
worksheet.getRange("A1:C4").setValue(sourceData);
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "PivotTable1");
pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
IPivotLines pivotLines = pivotTable.getPivotRowAxis().getPivotLines();
IPivotLines collection attached to this pivot axis.