use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotCaches in project poi by apache.
the class XSSFWorkbook method addPivotCache.
/**
* Add pivotCache to the workbook
*/
@Beta
protected CTPivotCache addPivotCache(String rId) {
CTWorkbook ctWorkbook = getCTWorkbook();
CTPivotCaches caches;
if (ctWorkbook.isSetPivotCaches()) {
caches = ctWorkbook.getPivotCaches();
} else {
caches = ctWorkbook.addNewPivotCaches();
}
CTPivotCache cache = caches.addNewPivotCache();
int tableId = getPivotTables().size() + 1;
cache.setCacheId(tableId);
cache.setId(rId);
if (pivotCaches == null) {
pivotCaches = new ArrayList<CTPivotCache>();
}
pivotCaches.add(cache);
return cache;
}
Aggregations