Commit fbf10a1b authored by Boris Kocherov's avatar Boris Kocherov

make changeOffset working for string arguments in formula by execute changeOffsetElem

parent 421aed44
......@@ -5180,8 +5180,39 @@ parserFormula.prototype.parse = function(local, digitDelim) {
/* Для обратной сборки функции иногда необходимо поменять ссылки на ячейки */
parserFormula.prototype.changeOffset = function (offset, canResize) {//offset = AscCommonExcel.CRangeOffset
var elemArr = [], currentElement = null, arg,
disable_changeOffset_run = false;
for (var i = 0; i < this.outStack.length; i++) {
this.changeOffsetElem(this.outStack[i], this.outStack, i, offset, canResize);
currentElement = this.outStack[i];
this.changeOffsetElem(currentElement, this.outStack, i, offset, canResize);
if (disable_changeOffset_run) {
continue;
}
if (currentElement.name == "(") {
continue;
}
if (currentElement.type === cElementType.operator || currentElement.type === cElementType.func) {
if (elemArr.length < currentElement.getArguments()) {
disable_changeOffset_run = true;
continue;
} else {
if (currentElement && currentElement.changeOffsetElem) {
arg = [];
for (var ind = 0; ind < currentElement.getArguments(); ind++) {
arg.unshift(elemArr.pop());
}
currentElement.changeOffsetElem(arg, offset);
}
// calculation not work on changeOffset stage
elemArr.push(new cEmpty());
}
} else if (currentElement.type === cElementType.name || currentElement.type === cElementType.name3D) {
elemArr.push(currentElement.Calculate(null, rangeCell));
} else if (currentElement.type === cElementType.table) {
elemArr.push(currentElement.toRef(rangeCell.getBBox0()));
} else {
elemArr.push(currentElement);
}
}
return this;
};
......
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