[]
Iterable<IPivotTable>IPivotTable 对象的集合。使用此接口可以访问工作表上的现有数据透视表报表,或通过 add(IPivotCache,IRange) 或 add(IPivotCache,IRange,String) 添加新的数据透视表报表。IPivotTables 实例通常从 IWorksheet.getPivotTables() 获取。
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Name", "Value"},
{"A", 100},
{"B", 200}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
IPivotTables pivotTables = worksheet.getPivotTables();
add(IPivotCache PivotCache,
IRange TableDestination) add(IPivotCache PivotCache,
IRange TableDestination,
String TableName) get(int index) IPivotTable。IPivotTable。intgetCount()IPivotTable 对象的数量。forEach, iterator, spliteratorIPivotTable 对象的数量。使用此方法可以确定工作表上可用的数据透视表报告数量。
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Name", "Value"},
{"A", 100},
{"B", 200}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
int count = worksheet.getPivotTables().getCount();
此重载会将 null 作为表名称传递给add(IPivotCache,IRange,String)。
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Region", "Sales"},
{"East", 120},
{"West", 150},
{"North", 90}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"));
PivotCache - 为新数据透视表报告提供源数据的数据透视表缓存。TableDestination - 放置数据透视表报告的目标区域左上角单元格。目标区域必须位于包含此 IPivotTables 集合的工作表上。从指定的 IPivotCache 创建数据透视表报告,并将其放置在包含此 IPivotTables 集合的工作表上的指定目标区域。
worksheet.getRange("A1:C4").setValue(new Object[][] {
{"Region", "Product", "Amount"},
{"East", "Apple", 120},
{"West", "Apple", 80},
{"East", "Orange", 90}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
PivotCache - 新数据透视表报告所基于的数据透视表缓存。此参数不得为 null。TableDestination - 放置数据透视表报告的目标区域左上角单元格。目标区域必须位于包含此 IPivotTables 集合的工作表上,并且不得为 null。TableName - 新数据透视表报告的名称。此值可以为 null。IPivotTable。使用此方法可以按 IPivotTables 集合中的位置检索当前工作表上的现有数据透视表报告。
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Region", "Sales"},
{"East", 100},
{"West", 200}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
IPivotTable pivotTable = worksheet.getPivotTables().get(0);
index - 要检索的 PivotTable 的从零开始的索引。IPivotTable。使用此方法可以按名称检索当前工作表上的现有数据透视表报告。
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Region", "Sales"},
{"East", 100},
{"West", 200}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
IPivotTable pivotTable = worksheet.getPivotTables().get("SalesPivot");
name - 要检索的 PivotTable 的名称。