Commit 7b92bec7 authored by konovalovsergey's avatar konovalovsergey

open/save pivot only with "worksheet" cacheSource type

parent 3319b649
......@@ -1006,11 +1006,13 @@ var editor;
if (content) {
pivotTableCacheDefinition = new CT_PivotCacheDefinition();
new openXml.SaxParserBase().parse(content, pivotTableCacheDefinition);
wb.pivotCaches[wbPivotCacheXml.cacheId] = pivotTableCacheDefinition;
if (pivotTableCacheDefinition.id) {
var partPivotTableCacheRecords = pivotTableCacheDefinitionPart.getPartById(
pivotTableCacheDefinition.id);
return partPivotTableCacheRecords.getDocumentContent();
if (pivotTableCacheDefinition.isValidCacheSource()) {
wb.pivotCaches[wbPivotCacheXml.cacheId] = pivotTableCacheDefinition;
if (pivotTableCacheDefinition.id) {
var partPivotTableCacheRecords = pivotTableCacheDefinitionPart.getPartById(
pivotTableCacheDefinition.id);
return partPivotTableCacheRecords.getDocumentContent();
}
}
}
}).then(function (content) {
......@@ -1047,8 +1049,8 @@ var editor;
var cacheDefinition = wb.pivotCaches[pivotTable.cacheId];
if (cacheDefinition) {
pivotTable.cacheDefinition = cacheDefinition;
ws.pivotTables.push(pivotTable);
}
ws.pivotTables.push(pivotTable);
}
}
wsIndex++;
......
......@@ -1744,6 +1744,9 @@ CT_PivotCacheDefinition.prototype.getFields = function () {
CT_PivotCacheDefinition.prototype.getRecords = function () {
return this.cacheRecords && this.cacheRecords.r;
};
CT_PivotCacheDefinition.prototype.isValidCacheSource = function () {
return this.cacheSource && this.cacheSource.type === c_oAscSourceType.Worksheet;
};
function CT_PivotCacheRecords() {
//Attributes
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