Commit 8f3c61df authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 35306

Corrected the function OFFSET
parent ebc09014
...@@ -874,7 +874,7 @@ ...@@ -874,7 +874,7 @@
if (this.argumentsCurrent >= 4) { if (this.argumentsCurrent >= 4) {
arg3 = arg[3].tocNumber(); arg3 = arg[3].tocNumber();
} }
if (this.argumentsCurrent == 5) { if (5 === this.argumentsCurrent) {
arg4 = arg[4].tocNumber(); arg4 = arg[4].tocNumber();
} }
...@@ -896,53 +896,35 @@ ...@@ -896,53 +896,35 @@
arg4 = 1; arg4 = 1;
} }
if (cElementType.cell === arg0.type || cElementType.cell3D === arg0.type) { if (cElementType.cell === arg0.type || cElementType.cell3D === arg0.type ||
cElementType.cellsRange === arg0.type || cElementType.cellsRange3D === arg0.type) {
var range = arg0.getRange(), bbox = range.getBBox0(), box = {r1: 0, r2: 0, c1: 0, c2: 0}, ref; var box = arg0.getBBox0();
if (box) {
box = box.clone(true);
box.r1 = bbox.r1 + arg1; box.r2 = box.r1 + arg1 + arg3 - 1;
box.c1 = bbox.c1 + arg2; box.c2 = box.c1 + arg2 + arg4 - 1;
box.r2 = bbox.r1 + arg1 + arg3 - 1; box.r1 = box.r1 + arg1;
box.c2 = bbox.c1 + arg2 + arg4 - 1; box.c1 = box.c1 + arg2;
if (!validBBOX(box)) { if (!validBBOX(box)) {
return this.value = new cError(cErrorType.bad_reference); return this.value = new cError(cErrorType.bad_reference);
} }
if (box.r1 == box.r2 && box.c1 == box.c2) { var name = box.getName();
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1); var ws = arg0.getWS();
this.value = (cElementType.cell === arg0.type) ? new cRef(ref, arg0.ws) : new cRef3D(ref, arg0.ws); var wsCell = arguments[3];
} else { if (box.isOneCell()) {
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1) + ":" + this.value = wsCell === ws ? new cRef(name, ws) : new cRef3D(name, ws);
g_oCellAddressUtils.colnumToColstrFromWsView(box.c2 + 1) + _getRowTitle(box.r2); } else {
this.value = this.value = wsCell === ws ? new cArea(name, ws) : new cArea3D(name, ws, ws);
(cElementType.cell === arg0.type) ? new cArea(ref, arg0.ws) : new cArea3D(ref, arg0.ws, arg0.ws); }
} }
}
} else if (cElementType.cellsRange === arg0.type) { if (!this.value) {
var bbox = arg0.getBBox0(), box = {r1: 0, r2: 0, c1: 0, c2: 0}, ref;
box.r1 = bbox.r1 + arg1;
box.c1 = bbox.c1 + arg2;
box.r2 = bbox.r1 + arg1 + arg3 - 1;
box.c2 = bbox.c1 + arg2 + arg4 - 1;
if (!validBBOX(box)) {
return this.value = new cError(cErrorType.bad_reference);
}
if (box.r1 == box.r2 && box.c1 == box.c2) {
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1);
this.value = new cRef(ref, arg0.ws);
} else {
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1) + ":" +
g_oCellAddressUtils.colnumToColstrFromWsView(box.c2 + 1) + _getRowTitle(box.r2);
this.value = new cArea(ref, arg0.ws);
}
} else {
this.value = new cError(cErrorType.wrong_value_type); this.value = new cError(cErrorType.wrong_value_type);
} }
return this.value; return this.value;
}; };
......
...@@ -1509,6 +1509,9 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1509,6 +1509,9 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
cRef3D.prototype.getWS = function () { cRef3D.prototype.getWS = function () {
return this.ws; return this.ws;
}; };
cRef3D.prototype.getMatrix = function () {
return [[this.getValue()]];
};
cRef3D.prototype.getBBox0 = function () { cRef3D.prototype.getBBox0 = function () {
var range = this.getRange(); var range = this.getRange();
if (range) { if (range) {
......
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