Commit c03c94d2 authored by konovalovsergey's avatar konovalovsergey

totalRowTable change formula string to parserFormula, renameSheetCopy for copy sheet

parent d6bb24b1
This diff is collapsed.
...@@ -1486,7 +1486,7 @@ ...@@ -1486,7 +1486,7 @@
if(null != tableColumn.TotalsRowFormula) if(null != tableColumn.TotalsRowFormula)
{ {
this.memory.WriteByte(c_oSer_TableColumns.TotalsRowFormula); this.memory.WriteByte(c_oSer_TableColumns.TotalsRowFormula);
this.memory.WriteString2(tableColumn.TotalsRowFormula); this.memory.WriteString2(tableColumn.TotalsRowFormula.Formula);
} }
if(null != tableColumn.dxf) if(null != tableColumn.dxf)
{ {
...@@ -3380,7 +3380,7 @@ ...@@ -3380,7 +3380,7 @@
// this.memory.WriteByte(c_oSerPropLenType.Byte); // this.memory.WriteByte(c_oSerPropLenType.Byte);
// this.memory.WriteBool(oFormula.bx); // this.memory.WriteBool(oFormula.bx);
// } // }
if(null != formulaParsed.ca) if(true === formulaParsed.ca)
{ {
this.memory.WriteByte(c_oSerFormulaTypes.Ca); this.memory.WriteByte(c_oSerFormulaTypes.Ca);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
...@@ -3906,12 +3906,13 @@ ...@@ -3906,12 +3906,13 @@
}; };
} }
/** @constructor */ /** @constructor */
function Binary_TableReader(stream, ws, Dxfs) function Binary_TableReader(stream, oReadResult, ws, Dxfs)
{ {
this.stream = stream; this.stream = stream;
this.ws = ws; this.ws = ws;
this.Dxfs = Dxfs; this.Dxfs = Dxfs;
this.bcr = new Binary_CommonReader(this.stream); this.bcr = new Binary_CommonReader(this.stream);
this.oReadResult = oReadResult;
this.Read = function(length, aTables) this.Read = function(length, aTables)
{ {
var res = c_oSerConstants.ReadOk; var res = c_oSerConstants.ReadOk;
...@@ -3932,7 +3933,7 @@ ...@@ -3932,7 +3933,7 @@
return oThis.ReadTable(t,l, oNewTable); return oThis.ReadTable(t,l, oNewTable);
}); });
if(null != oNewTable.Ref && null != oNewTable.DisplayName) if(null != oNewTable.Ref && null != oNewTable.DisplayName)
this.ws.workbook.dependencyFormulas.addTableName(this.ws, oNewTable); this.ws.workbook.dependencyFormulas.addTableName(this.ws, oNewTable, true);
aTables.push(oNewTable); aTables.push(oNewTable);
} }
else else
...@@ -4288,10 +4289,10 @@ ...@@ -4288,10 +4289,10 @@
oTableColumn.TotalsRowLabel = this.stream.GetString2LE(length); oTableColumn.TotalsRowLabel = this.stream.GetString2LE(length);
else if ( c_oSer_TableColumns.TotalsRowFunction == type ) else if ( c_oSer_TableColumns.TotalsRowFunction == type )
oTableColumn.TotalsRowFunction = this.stream.GetUChar(); oTableColumn.TotalsRowFunction = this.stream.GetUChar();
else if ( c_oSer_TableColumns.TotalsRowFormula == type ) else if ( c_oSer_TableColumns.TotalsRowFormula == type ) {
oTableColumn.TotalsRowFormula = this.stream.GetString2LE(length); var formula = this.stream.GetString2LE(length);
else if ( c_oSer_TableColumns.DataDxfId == type ) this.oReadResult.tableCustomFunc.push({formula: formula, column: oTableColumn, ws: this.ws});
{ } else if ( c_oSer_TableColumns.DataDxfId == type ) {
var DxfId = this.stream.GetULongLE(); var DxfId = this.stream.GetULongLE();
oTableColumn.dxf = this.Dxfs[DxfId]; oTableColumn.dxf = this.Dxfs[DxfId];
} }
...@@ -5400,7 +5401,7 @@ ...@@ -5400,7 +5401,7 @@
}; };
} }
/** @constructor */ /** @constructor */
function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, oMediaArray, copyPasteObj) function Binary_WorksheetTableReader(stream, oReadResult, wb, aSharedStrings, aCellXfs, Dxfs, oMediaArray, copyPasteObj)
{ {
this.stream = stream; this.stream = stream;
this.wb = wb; this.wb = wb;
...@@ -5413,6 +5414,7 @@ ...@@ -5413,6 +5414,7 @@
this.aHyperlinks = []; this.aHyperlinks = [];
this.copyPasteObj = copyPasteObj; this.copyPasteObj = copyPasteObj;
this.curWorksheet = null; this.curWorksheet = null;
this.oReadResult = oReadResult;
this.Read = function() this.Read = function()
{ {
var oThis = this; var oThis = this;
...@@ -5604,7 +5606,7 @@ ...@@ -5604,7 +5606,7 @@
} }
else if ( c_oSerWorksheetsTypes.Autofilter == type ) else if ( c_oSerWorksheetsTypes.Autofilter == type )
{ {
oBinary_TableReader = new Binary_TableReader(this.stream, oWorksheet, this.Dxfs); oBinary_TableReader = new Binary_TableReader(this.stream, this.oReadResult, oWorksheet, this.Dxfs);
oWorksheet.AutoFilter = new AscCommonExcel.AutoFilter(); oWorksheet.AutoFilter = new AscCommonExcel.AutoFilter();
res = this.bcr.Read1(length, function(t,l){ res = this.bcr.Read1(length, function(t,l){
return oBinary_TableReader.ReadAutoFilter(t,l, oWorksheet.AutoFilter); return oBinary_TableReader.ReadAutoFilter(t,l, oWorksheet.AutoFilter);
...@@ -5612,7 +5614,7 @@ ...@@ -5612,7 +5614,7 @@
} }
else if ( c_oSerWorksheetsTypes.TableParts == type ) else if ( c_oSerWorksheetsTypes.TableParts == type )
{ {
oBinary_TableReader = new Binary_TableReader(this.stream, oWorksheet, this.Dxfs); oBinary_TableReader = new Binary_TableReader(this.stream, this.oReadResult, oWorksheet, this.Dxfs);
oBinary_TableReader.Read(length, oWorksheet.TableParts); oBinary_TableReader.Read(length, oWorksheet.TableParts);
} else if ( c_oSerWorksheetsTypes.Comments == type } else if ( c_oSerWorksheetsTypes.Comments == type
&& !(typeof editor !== "undefined" && editor.WordControl && editor.WordControl.m_oLogicDocument && Array.isArray(editor.WordControl.m_oLogicDocument.Slides))) { && !(typeof editor !== "undefined" && editor.WordControl && editor.WordControl.m_oLogicDocument && Array.isArray(editor.WordControl.m_oLogicDocument.Slides))) {
...@@ -6961,6 +6963,9 @@ ...@@ -6961,6 +6963,9 @@
isCopyPaste: isCopyPaste, isCopyPaste: isCopyPaste,
activeRange: null activeRange: null
}; };
this.oReadResult = {
tableCustomFunc: []
};
this.getbase64DecodedData = function(szSrc) this.getbase64DecodedData = function(szSrc)
{ {
var nType = 0; var nType = 0;
...@@ -7195,7 +7200,7 @@ ...@@ -7195,7 +7200,7 @@
// res = (new Binary_WorkbookTableReader(this.stream, wb)).Read(); // res = (new Binary_WorkbookTableReader(this.stream, wb)).Read();
// break; // break;
case c_oSerTableTypes.Worksheets: case c_oSerTableTypes.Worksheets:
res = (new Binary_WorksheetTableReader(this.stream, wb, aSharedStrings, aCellXfs, aDxfs, oMediaArray, this.copyPasteObj)).Read(); res = (new Binary_WorksheetTableReader(this.stream, this.oReadResult, wb, aSharedStrings, aCellXfs, aDxfs, oMediaArray, this.copyPasteObj)).Read();
break; break;
// case c_oSerTableTypes.CalcChain: // case c_oSerTableTypes.CalcChain:
// res = (new Binary_CalcChainTableReader(this.stream, wb.calcChain)).Read(); // res = (new Binary_CalcChainTableReader(this.stream, wb.calcChain)).Read();
...@@ -7218,9 +7223,9 @@ ...@@ -7218,9 +7223,9 @@
if(c_oSerConstants.ReadOk == res) if(c_oSerConstants.ReadOk == res)
res = (new Binary_WorkbookTableReader(this.stream, wb)).Read(); res = (new Binary_WorkbookTableReader(this.stream, wb)).Read();
} }
wb.init(); wb.init(this.oReadResult.tableCustomFunc);
} else if(window["Asc"] && window["Asc"]["editor"] !== undefined){ } else if(window["Asc"] && window["Asc"]["editor"] !== undefined){
wb.init(true); wb.init(this.oReadResult.tableCustomFunc, true);
} }
return res; return res;
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -898,9 +898,12 @@ ...@@ -898,9 +898,12 @@
if(!undoData) if(!undoData)
return; return;
if(undoData.clone) if (undoData.clone) {
cloneData = undoData.clone(null); cloneData = undoData.clone(null);
else if (cloneData.buildDependencies) {
cloneData.buildDependencies();
}
} else
cloneData = undoData; cloneData = undoData;
if(!cloneData) if(!cloneData)
...@@ -1066,7 +1069,10 @@ ...@@ -1066,7 +1069,10 @@
{ {
this._cleanStyleTable(cloneData.Ref); this._cleanStyleTable(cloneData.Ref);
worksheet.workbook.dependencyFormulas.delTableName(worksheet.TableParts[l].DisplayName); worksheet.workbook.dependencyFormulas.delTableName(worksheet.TableParts[l].DisplayName);
worksheet.TableParts.splice(l,1); var deleted = worksheet.TableParts.splice(l,1);
for (var delIndex = 0; i < deleted.length; ++i) {
deleted[delIndex].removeDependencies();
}
} }
} }
} }
...@@ -1153,7 +1159,7 @@ ...@@ -1153,7 +1159,7 @@
if(isTablePart) if(isTablePart)
worksheet.workbook.dependencyFormulas.delTableName(oldFilter.DisplayName) worksheet.workbook.dependencyFormulas.delTableName(oldFilter.DisplayName)
} else } else
return oldFilter; return filter;
}; };
if(worksheet.AutoFilter) if(worksheet.AutoFilter)
...@@ -1163,14 +1169,17 @@ ...@@ -1163,14 +1169,17 @@
if(worksheet.TableParts) if(worksheet.TableParts)
{ {
var newTableParts = []; var newTableParts = [];
for(var i = 0; i < worksheet.TableParts.length; i++) for(var i = 0; i < worksheet.TableParts.length; i++)
{ {
var filter = changeFilter(worksheet.TableParts[i], true); var tablePart = worksheet.TableParts[i];
if(filter) var filter = changeFilter(tablePart, true);
if(filter){
newTableParts.push(filter); newTableParts.push(filter);
} else {
tablePart.removeDependencies();
}
} }
worksheet.TableParts = newTableParts; worksheet.TableParts = newTableParts;
} }
...@@ -2435,7 +2444,7 @@ ...@@ -2435,7 +2444,7 @@
if(val === true) if(val === true)
{ {
tablePart.generateTotalsRowLabel(); tablePart.generateTotalsRowLabel(worksheet);
} }
} }
...@@ -2912,7 +2921,7 @@ ...@@ -2912,7 +2921,7 @@
if(cell.isFormula()) if(cell.isFormula())
{ {
var val = cell.getFormula(); var val = cell.getFormula();
tableColumn.setTotalsRowFormula(val); tableColumn.setTotalsRowFormula(val, worksheet);
} }
else else
{ {
......
...@@ -12445,7 +12445,7 @@ ...@@ -12445,7 +12445,7 @@
for (var i = 0; i < tableParts.length; i++) { for (var i = 0; i < tableParts.length; i++) {
this.model.autoFilters._setColorStyleTable(tableParts[i].Ref, tableParts[i]); this.model.autoFilters._setColorStyleTable(tableParts[i].Ref, tableParts[i]);
//TODO пока заменяем при открытии на TotalsRowFormula //TODO пока заменяем при открытии на TotalsRowFormula
tableParts[i].checkTotalRowFormula(); tableParts[i].checkTotalRowFormula(worksheet);
} }
} }
......
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