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