[]
Iterable<IPivotCache> IPivotCaches 集合提供对工作簿中所有 IPivotCache 对象的访问。使用此接口可按索引检索现有缓存、获取缓存数量,或在创建数据透视表报表之前从工作表区域或表创建新缓存。
worksheet.getRange("A1:C4").setValue(new Object[][] {
{"Product", "Category", "Amount"},
{"Carrots", "Vegetables", 1200},
{"Broccoli", "Vegetables", 850},
{"Bananas", "Fruit", 640}
});
IPivotCaches pivotCaches = workbook.getPivotCaches();
IPivotCache pivotCache = pivotCaches.create(worksheet.getRange("A1:C4"));
get(int index) IPivotCache。intgetCount()IPivotCache 对象的数量。forEach, iterator, spliteratorIPivotCache 对象的数量。使用此方法可确定工作簿中当前可用的 PivotTable 缓存数量。
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Product", "Amount"},
{"Apple", 100},
{"Banana", 200}
});
worksheet.getRange("D1:E3").setValue(new Object[][] {
{"Region", "Sales"},
{"East", 300},
{"West", 250}
});
IPivotCaches pivotCaches = workbook.getPivotCaches();
pivotCaches.create(worksheet.getRange("A1:B3"));
pivotCaches.create(worksheet.getRange("D1:E3"));
int count = pivotCaches.getCount();
IPivotCache。使用 create(Object) 创建后,可使用此方法从工作簿的 IPivotCaches 集合中检索 PivotCache。
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Category", "Amount"},
{"Beverages", 100},
{"Snacks", 200}
});
IPivotCaches pivotCaches = workbook.getPivotCaches();
pivotCaches.create(worksheet.getRange("A1:B3"));
IPivotCache pivotCache = pivotCaches.get(0);
index - 要检索的 PivotCache 的索引。IPivotCache。使用此方法可生成稍后用于创建 PivotTable 的 PivotCache。源数据必须是 IRange 或 ITable。
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Region", "Sales"},
{"East", 120},
{"West", 150},
{"East", 90}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
SourceData - 新 PivotCache 的源数据。此值必须是 IRange 或 ITable;不支持 null。IPivotCache。IllegalArgumentException - 如果 SourceData 不是 IRange 或 ITable。