Interface IPivotValueCell
public interface IPivotValueCell
表示数据透视表值单元格,并在实际单元格区域不可用时提供对其值和相关
IPivotCell 的访问。
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();
Object value = valueCell.getValue();
-
Method Summary
返回指定 PivotValueCell 位置的 PivotCell。只读。
返回该位置处的值。该值是在应用 ShowAs 和其他计算之后的值。返回的对象可以表示空单元格值、数值、日期值、文本值或错误值。
-
Method Details
-
getPivotCell
返回指定 PivotValueCell 位置的 PivotCell。只读。
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
IPivotCell pivotCell = valueCell.getPivotCell();
IRange range = pivotCell.getRange();
- Returns:
- 指定 PivotValueCell 位置的 PivotCell。
-
getValue
返回该位置处的值。该值是在应用 ShowAs 和其他计算之后的值。返回的对象可以表示空单元格值、数值、日期值、文本值或错误值。
IPivotValueCell valueCell = pivotTable.pivotValueCell(0, 0);
Object value = valueCell.getValue();
- Returns:
- 该位置处的值。