Interface IPivotCell
public interface IPivotCell
Represents a cell in a PivotTable report.
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);
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
PivotCellType cellType = pivotCell.getPivotCellType();
-
Method Summary
Returns a PivotItemList collection that corresponds to the items on the column axis that represent the selected range.
Returns the custom subtotal function field setting of a PivotCell object.
Returns a PivotField object that corresponds to the selected data field.
Returns a constant that identifies the PivotTable entity the cell corresponds to.
Returns the PivotLine corresponding to the column where the PivotCell is located.
Returns a PivotField object that represents the PivotTable field that contains the upper-left corner of the specified range.
Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.
Returns the PivotLine corresponding to the row where the PivotCell is located.
Returns the PivotTable that contains this pivot cell, or the PivotTable associated with a PivotChart.
Returns a Range object that represents the range the specified PivotCell applies to.
Returns a PivotItemList collection that corresponds to the items on the category axis that represent the selected cell.
-
Method Details
-
getRowItems
Returns a PivotItemList collection that corresponds to the items on the category axis that represent the selected cell.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotItemList rowItems = pivotCell.getRowItems();
- Returns:
- A PivotItemList collection that corresponds to the items on the category axis that represent the selected cell.
-
getColumnItems
Returns a PivotItemList collection that corresponds to the items on the column axis that represent the selected range.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotItemList columnItems = pivotCell.getColumnItems();
- Returns:
- A PivotItemList collection that corresponds to the items on the column axis that represent the selected range.
-
getCustomSubtotalFunction
Returns the custom subtotal function field setting of a PivotCell object.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
ConsolidationFunction function = pivotCell.getCustomSubtotalFunction();
- Returns:
- The custom subtotal function field setting of a PivotCell object.
-
getDataField
Returns a PivotField object that corresponds to the selected data field.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotField dataField = pivotCell.getDataField();
- Returns:
- A PivotField object that corresponds to the selected data field.
-
getPivotCellType
Returns a constant that identifies the PivotTable entity the cell corresponds to.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
PivotCellType cellType = pivotCell.getPivotCellType();
- Returns:
- A constant that identifies the PivotTable entity the cell corresponds to.
-
getPivotColumnLine
Returns the PivotLine corresponding to the column where the PivotCell is located.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotLine columnLine = pivotCell.getPivotColumnLine();
- Returns:
- The PivotLine corresponding to the column where the PivotCell is located.
-
getPivotField
Returns a PivotField object that represents the PivotTable field that contains the upper-left corner of the specified range.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotField field = pivotCell.getPivotField();
- Returns:
- A PivotField object that represents the PivotTable field that contains the upper-left corner of the specified range.
-
getPivotItem
Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotItem item = pivotCell.getPivotItem();
- Returns:
- A PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.
-
getPivotRowLine
Returns the PivotLine corresponding to the row where the PivotCell is located.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotLine rowLine = pivotCell.getPivotRowLine();
- Returns:
- The PivotLine corresponding to the row where the PivotCell is located.
-
getPivotTable
Returns the PivotTable that contains this pivot cell, or the PivotTable associated with a PivotChart.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IPivotTable parentPivotTable = pivotCell.getPivotTable();
- Returns:
- The
IPivotTable that contains this pivot cell, or the PivotTable associated with a PivotChart.
-
getRange
Returns a Range object that represents the range the specified PivotCell applies to.
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IRange range = pivotCell.getRange();
- Returns:
- A Range object that represents the range the specified PivotCell applies to.