Commit 689ad408 authored by konovalovsergey's avatar konovalovsergey

delete table

parent 486c7847
...@@ -3839,7 +3839,9 @@ function parserFormula( formula, parent, _ws ) { ...@@ -3839,7 +3839,9 @@ function parserFormula( formula, parent, _ws ) {
this.shiftCells(data.type, data.sheetId, data.bbox, data.offset); this.shiftCells(data.type, data.sheetId, data.bbox, data.offset);
eventData.isRebuild = false; eventData.isRebuild = false;
} else if (AscCommon.c_oNotifyType.ChangeDefName === data.type) { } else if (AscCommon.c_oNotifyType.ChangeDefName === data.type) {
if (data.from.name != data.to.name) { if (!data.to) {
this.removeTableName(data.from);
} else if (data.from.name != data.to.name) {
this.changeDefName(data.from, data.to); this.changeDefName(data.from, data.to);
} else if (data.from.isTable) { } else if (data.from.isTable) {
needAssemble = false; needAssemble = false;
...@@ -4545,6 +4547,14 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4545,6 +4547,14 @@ parserFormula.prototype.parse = function(local, digitDelim) {
else if (_tableTMP = parserHelp.isTable.call(this, this.Formula, this.pCurrPos, local)) { else if (_tableTMP = parserHelp.isTable.call(this, this.Formula, this.pCurrPos, local)) {
found_operand = new cStrucTable(_tableTMP, this.wb, this.ws); found_operand = new cStrucTable(_tableTMP, this.wb, this.ws);
if (found_operand.type == cElementType.error) {
/*используется неверный именованный диапазон или таблица*/
this.error.push(c_oAscError.ID.FrmlAnotherParsingError);
this.outStack = [];
this.elemArr = [];
return false;
}
if (found_operand.type != cElementType.error) { if (found_operand.type != cElementType.error) {
this.RefPos.push({ this.RefPos.push({
start: this.pCurrPos - this.operand_str.length, start: this.pCurrPos - this.operand_str.length,
...@@ -4555,17 +4565,7 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4555,17 +4565,7 @@ parserFormula.prototype.parse = function(local, digitDelim) {
}); });
this.countRef++; this.countRef++;
} }
}
// if(found_operand.type==cElementType.error) {
// /*используется неверный именованный диапазон или таблица*/
// this.error.push( c_oAscError.ID.FrmlAnotherParsingError );
// this.outStack = [];
// this.elemArr = [];
// return false;
// }
}
/* Referens to DefinedNames */ else if (parserHelp.isName.call(this, this.Formula, this.pCurrPos, this.wb, /* Referens to DefinedNames */ else if (parserHelp.isName.call(this, this.Formula, this.pCurrPos, this.wb,
this.ws)[0]) { this.ws)[0]) {
...@@ -4820,18 +4820,8 @@ parserFormula.prototype.calculate = function(opt_defName, opt_range) { ...@@ -4820,18 +4820,8 @@ parserFormula.prototype.calculate = function(opt_defName, opt_range) {
var i, elem, sheetId; var i, elem, sheetId;
for (i = 0; i < this.outStack.length; i++) { for (i = 0; i < this.outStack.length; i++) {
elem = this.outStack[i]; elem = this.outStack[i];
if (elem.type == cElementType.table) { if (elem.type == cElementType.table && elem.tableName == defName.name) {
sheetId = elem.ws ? elem.ws.getId() : null; this.outStack[i] = new cError(cErrorType.bad_reference);
if (elem.tableName == defName.name && (null == defName.sheetId || sheetId == defName.sheetId )) {
var rangeCell = null;
if (this.parent && this.parent.onFormulaEvent) {
rangeCell = this.parent.onFormulaEvent(AscCommon.c_oNotifyParentType.GetRangeCell);
}
if (!rangeCell) {
rangeCell = this.ws.getCell3(0, 0);
}
this.outStack[i] = elem.toRef(rangeCell.getBBox0());
}
} }
} }
}; };
......
...@@ -755,9 +755,8 @@ ...@@ -755,9 +755,8 @@
delTableName: function(tableName) { delTableName: function(tableName) {
var defName = this._delDefName(tableName, null); var defName = this._delDefName(tableName, null);
this.addToChangedDefName(defName); this.addToChangedDefName(defName);
//todo make ref var notifyData = {type: AscCommon.c_oNotifyType.ChangeDefName, from: defName.getUndoDefName(), to: null};
// var notifyData = {type: AscCommon.c_oNotifyType.ChangeDefName, from: defName.getAscCDefName(), to: null}; this._broadcastDefName(tableName, notifyData);
// this._broadcastDefName(tableName, notifyData);
}, },
rebuildTable: function(tableName) { rebuildTable: function(tableName) {
var defName = this.getDefNameByName(tableName, null); var defName = this.getDefNameByName(tableName, null);
......
...@@ -1221,7 +1221,7 @@ ...@@ -1221,7 +1221,7 @@
for (var i = worksheet.TableParts.length - 1; i >= 0; i--) for (var i = worksheet.TableParts.length - 1; i >= 0; i--)
{ {
var tablePart = worksheet.TableParts[i]; var tablePart = worksheet.TableParts[i];
if (!changeFilter(tablePart, true)) { if (changeFilter(tablePart, true)) {
worksheet.deleteTablePart(i); worksheet.deleteTablePart(i);
} }
} }
......
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