Commit d7fbc543 authored by GoshaZotov's avatar GoshaZotov

add renameSheetCopy into clone() tableColumns

parent 12185fba
...@@ -5368,7 +5368,7 @@ function TableColumn() { ...@@ -5368,7 +5368,7 @@ function TableColumn() {
this.TotalsRowFormula.removeDependencies(); this.TotalsRowFormula.removeDependencies();
} }
}; };
TableColumn.prototype.clone = function(opt_TableName) { TableColumn.prototype.clone = function(opt_TableName, ws, renameParams) {
var res = new TableColumn(); var res = new TableColumn();
res.Name = this.Name; res.Name = this.Name;
res.TotalsRowLabel = this.TotalsRowLabel; res.TotalsRowLabel = this.TotalsRowLabel;
...@@ -5380,7 +5380,14 @@ TableColumn.prototype.clone = function(opt_TableName) { ...@@ -5380,7 +5380,14 @@ TableColumn.prototype.clone = function(opt_TableName) {
} else { } else {
} }
res._setTotalRowFormula(this.TotalsRowFormula.Formula, this.TotalsRowFormula.ws, false);
ws = ws ? ws : this.TotalsRowFormula.ws;
if(renameParams)
{
this.renameSheetCopy(ws, renameParams);
}
res._setTotalRowFormula(this.TotalsRowFormula.Formula, ws, false);
} }
if (this.dxf) if (this.dxf)
res.dxf = this.dxf.clone; res.dxf = this.dxf.clone;
......
...@@ -3491,18 +3491,22 @@ ...@@ -3491,18 +3491,22 @@
newFilter.TableStyleInfo.ShowRowStripes = true; newFilter.TableStyleInfo.ShowRowStripes = true;
} }
newFilter.DisplayName = newTableName;
worksheet.workbook.dependencyFormulas.addTableName(worksheet, newFilter);
var tableColumns; var tableColumns;
var isChangeTableNameInFormulaDependency = false;
if(tablePart && tablePart.TableColumns) if(tablePart && tablePart.TableColumns)
{ {
var renameParams = {};
renameParams.tableNameMap = {};
renameParams.tableNameMap[tablePart.DisplayName] = newTableName;
var cloneTableColumns = []; var cloneTableColumns = [];
for(var i = 0; i < tablePart.TableColumns.length; i++) for(var i = 0; i < tablePart.TableColumns.length; i++)
{ {
cloneTableColumns.push(tablePart.TableColumns[i].clone()); cloneTableColumns.push(tablePart.TableColumns[i].clone(null, worksheet, renameParams));
} }
tableColumns = cloneTableColumns; tableColumns = cloneTableColumns;
isChangeTableNameInFormulaDependency = true;
} }
else else
{ {
...@@ -3510,19 +3514,8 @@ ...@@ -3510,19 +3514,8 @@
} }
newFilter.TableColumns = tableColumns; newFilter.TableColumns = tableColumns;
newFilter.DisplayName = newTableName;
worksheet.workbook.dependencyFormulas.addTableName(worksheet, newFilter);
worksheet.TableParts[worksheet.TableParts.length] = newFilter; worksheet.TableParts[worksheet.TableParts.length] = newFilter;
if(isChangeTableNameInFormulaDependency)
{
var renameParams = {};
renameParams.tableNameMap = {};
renameParams.tableNameMap[tablePart.DisplayName] = newTableName;
newFilter.renameSheetCopy(worksheet, renameParams);
}
return worksheet.TableParts[worksheet.TableParts.length - 1]; return worksheet.TableParts[worksheet.TableParts.length - 1];
} }
}, },
......
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