Commit 7b92bec7 authored by konovalovsergey's avatar konovalovsergey

open/save pivot only with "worksheet" cacheSource type

parent 3319b649
...@@ -1006,11 +1006,13 @@ var editor; ...@@ -1006,11 +1006,13 @@ var editor;
if (content) { if (content) {
pivotTableCacheDefinition = new CT_PivotCacheDefinition(); pivotTableCacheDefinition = new CT_PivotCacheDefinition();
new openXml.SaxParserBase().parse(content, pivotTableCacheDefinition); new openXml.SaxParserBase().parse(content, pivotTableCacheDefinition);
wb.pivotCaches[wbPivotCacheXml.cacheId] = pivotTableCacheDefinition; if (pivotTableCacheDefinition.isValidCacheSource()) {
if (pivotTableCacheDefinition.id) { wb.pivotCaches[wbPivotCacheXml.cacheId] = pivotTableCacheDefinition;
var partPivotTableCacheRecords = pivotTableCacheDefinitionPart.getPartById( if (pivotTableCacheDefinition.id) {
pivotTableCacheDefinition.id); var partPivotTableCacheRecords = pivotTableCacheDefinitionPart.getPartById(
return partPivotTableCacheRecords.getDocumentContent(); pivotTableCacheDefinition.id);
return partPivotTableCacheRecords.getDocumentContent();
}
} }
} }
}).then(function (content) { }).then(function (content) {
...@@ -1047,8 +1049,8 @@ var editor; ...@@ -1047,8 +1049,8 @@ var editor;
var cacheDefinition = wb.pivotCaches[pivotTable.cacheId]; var cacheDefinition = wb.pivotCaches[pivotTable.cacheId];
if (cacheDefinition) { if (cacheDefinition) {
pivotTable.cacheDefinition = cacheDefinition; pivotTable.cacheDefinition = cacheDefinition;
ws.pivotTables.push(pivotTable);
} }
ws.pivotTables.push(pivotTable);
} }
} }
wsIndex++; wsIndex++;
......
...@@ -1744,6 +1744,9 @@ CT_PivotCacheDefinition.prototype.getFields = function () { ...@@ -1744,6 +1744,9 @@ CT_PivotCacheDefinition.prototype.getFields = function () {
CT_PivotCacheDefinition.prototype.getRecords = function () { CT_PivotCacheDefinition.prototype.getRecords = function () {
return this.cacheRecords && this.cacheRecords.r; return this.cacheRecords && this.cacheRecords.r;
}; };
CT_PivotCacheDefinition.prototype.isValidCacheSource = function () {
return this.cacheSource && this.cacheSource.type === c_oAscSourceType.Worksheet;
};
function CT_PivotCacheRecords() { function CT_PivotCacheRecords() {
//Attributes //Attributes
this.count = null; this.count = null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment