Row row = sheet.getRow(firstCell.getRow()); CTCacheFields cFields; if(ctPivotCacheDefinition.getCacheFields() != null) { cFields = ctPivotCacheDefinition.getCacheFields(); } else { cFields = ctPivotCacheDefinition.addNewCacheFields();
@Beta private void createDefaultValues() { ctPivotCacheDefinition.setCreatedVersion(XSSFPivotTable.CREATED_VERSION); ctPivotCacheDefinition.setMinRefreshableVersion(XSSFPivotTable.MIN_REFRESHABLE_VERSION); ctPivotCacheDefinition.setRefreshedVersion(XSSFPivotTable.UPDATED_VERSION); ctPivotCacheDefinition.setRefreshedBy("Apache POI"); ctPivotCacheDefinition.setRefreshedDate(new Date().getTime()); ctPivotCacheDefinition.setRefreshOnLoad(true); }
@Beta @Override protected void commit() throws IOException { PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); //Sets the pivotCacheDefinition tag xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotCacheDefinition.type.getName(). getNamespaceURI(), "pivotCacheDefinition")); ctPivotCacheDefinition.save(out, xmlOptions); out.close(); }
public void setCtPivotTable(CTPivotCacheDefinition ctPivotTable) { this.ctPivotTable = ctPivotTable; this.ctPivotTable.setSaveData(false); this.ctPivotTable.setRefreshOnLoad(true); if(this.ctPivotTable.isSetId()){ this.ctPivotTable.unsetId(); } }
private void savePivotCache(XLXContext context, List<String> savedParts, POIXMLDocumentPart pc) throws Exception { if ( pc.getPackageRelationship().getRelationshipType().equals(XLSXFactory.PIVOT_CACHE.getRelation())){ PivotTableCache cache = (PivotTableCache) pc; CTPivotCacheDefinition ctPivotTableCache = cache.getCtPivotTable(); for(CTCacheField field : ctPivotTableCache.getCacheFields().getCacheFieldArray()){ Object fieldName = CellExpressionParser.parseExpression(field.getName()).evaluate(context); if(fieldName != null){ field.setName(WrappingUtil.wrapTableColumnName(fieldName.toString())); } if(field.getFormula() != null){ field.setFormula(WrappingUtil.wrapFormula(field.getFormula(), context)); } } String casheEntryName = getEntryName(cache.getPackagePart()); savedParts.add(casheEntryName); out.putNextEntry(new ZipEntry(casheEntryName)); cache.writeTo(out); out.closeEntry(); } }
final CTWorksheetSource wsSource = ctPivotCacheDefinition.getCacheSource().getWorksheetSource();
pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().setId(pivotCacheDefinition.getRelationId(pivotCacheRecords));
CTCacheSource cacheSource = cacheDef.addNewCacheSource(); cacheSource.setType(STSourceType.WORKSHEET); CTWorksheetSource worksheetSource = cacheSource.addNewWorksheetSource();
final CTWorksheetSource wsSource = ctPivotCacheDefinition.getCacheSource().getWorksheetSource();
pivotTable.getPivotCacheDefinition().getCTPivotCacheDefinition().setId(pivotCacheDefinition.getRelationId(pivotCacheRecords));
CTCacheSource cacheSource = cacheDef.addNewCacheSource(); cacheSource.setType(STSourceType.WORKSHEET); CTWorksheetSource worksheetSource = cacheSource.addNewWorksheetSource();
@Beta private void createDefaultValues() { ctPivotCacheDefinition.setCreatedVersion(XSSFPivotTable.CREATED_VERSION); ctPivotCacheDefinition.setMinRefreshableVersion(XSSFPivotTable.MIN_REFRESHABLE_VERSION); ctPivotCacheDefinition.setRefreshedVersion(XSSFPivotTable.UPDATED_VERSION); ctPivotCacheDefinition.setRefreshedBy("Apache POI"); ctPivotCacheDefinition.setRefreshedDate(new Date().getTime()); ctPivotCacheDefinition.setRefreshOnLoad(true); }
Row row = sheet.getRow(firstCell.getRow()); CTCacheFields cFields; if(ctPivotCacheDefinition.getCacheFields() != null) { cFields = ctPivotCacheDefinition.getCacheFields(); } else { cFields = ctPivotCacheDefinition.addNewCacheFields();
@Beta @Override protected void commit() throws IOException { PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); //Sets the pivotCacheDefinition tag xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotCacheDefinition.type.getName(). getNamespaceURI(), "pivotCacheDefinition")); ctPivotCacheDefinition.save(out, xmlOptions); out.close(); }