Search in sources :

Example 1 with CTPivotCaches

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;
}
Also used : CTPivotCaches(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotCaches) CTWorkbook(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook) CTPivotCache(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotCache) Beta(org.apache.poi.util.Beta)

Aggregations

Beta (org.apache.poi.util.Beta)1 CTPivotCache (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotCache)1 CTPivotCaches (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotCaches)1 CTWorkbook (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook)1