Commit 4ce06863 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 20137

parent f6401886
...@@ -111,7 +111,6 @@ ...@@ -111,7 +111,6 @@
cADDRESS.prototype = Object.create(cBaseFunction.prototype); cADDRESS.prototype = Object.create(cBaseFunction.prototype);
cADDRESS.prototype.Calculate = function (arg) { cADDRESS.prototype.Calculate = function (arg) {
var rowNumber = arg[0], colNumber = arg[1], refType = arg[2] ? arg[2] : new cNumber(1), A1RefType = arg[3] ? var rowNumber = arg[0], colNumber = arg[1], refType = arg[2] ? arg[2] : new cNumber(1), A1RefType = arg[3] ?
arg[3] : new cBool(true), sheetName = arg[4] ? arg[4] : new cEmpty(); arg[3] : new cBool(true), sheetName = arg[4] ? arg[4] : new cEmpty();
...@@ -176,25 +175,29 @@ ...@@ -176,25 +175,29 @@
return this.value = new cError(cErrorType.wrong_value_type); return this.value = new cError(cErrorType.wrong_value_type);
} }
var strRef; var strRef;
var strColumn = A1RefType ? g_oCellAddressUtils.colnumToColstrFromWsView(colNumber) : colNumber; var absR, absC;
var strRow;
switch (refType - 1) { switch (refType - 1) {
case AscCommonExcel.referenceType.A: case AscCommonExcel.referenceType.A:
strRow = this._absolute(rowNumber, A1RefType); absR = true;
strColumn = this._absolute(strColumn, A1RefType); absC = true;
break; break;
case AscCommonExcel.referenceType.ARRC: case AscCommonExcel.referenceType.ARRC:
strRow = this._absolute(rowNumber, A1RefType); absR = true;
absC = false;
break; break;
case AscCommonExcel.referenceType.RRAC: case AscCommonExcel.referenceType.RRAC:
strColumn = this._absolute(strColumn, A1RefType); absR = false;
strRow = rowNumber; absC = true;
break; break;
case AscCommonExcel.referenceType.R: case AscCommonExcel.referenceType.R:
strRow = rowNumber; absR = false;
absC = false;
break; break;
} }
strRef = this._getRef(strRow, strColumn, A1RefType);
strRef = this._getRef(this._absolute(absR, rowNumber, A1RefType),
this._absolute(absC, A1RefType ? g_oCellAddressUtils.colnumToColstrFromWsView(colNumber) : colNumber, A1RefType),
A1RefType);
return this.value = return this.value =
new cString((cElementType.empty === sheetName.type) ? strRef : parserHelp.get3DRef(sheetName.toString(), strRef)); new cString((cElementType.empty === sheetName.type) ? strRef : parserHelp.get3DRef(sheetName.toString(), strRef));
...@@ -202,8 +205,9 @@ ...@@ -202,8 +205,9 @@
cADDRESS.prototype._getRef = function (row, col, A1RefType) { cADDRESS.prototype._getRef = function (row, col, A1RefType) {
return A1RefType ? col + row : 'R' + row + 'C' + col; return A1RefType ? col + row : 'R' + row + 'C' + col;
}; };
cADDRESS.prototype._absolute = function (val, A1RefType) { cADDRESS.prototype._absolute = function (abs, val, A1RefType) {
return A1RefType ? '$' + val : '[' + val + ']';
return abs ? (A1RefType ? '$' + val : val) : (A1RefType ? val : '[' + val + ']');
}; };
cADDRESS.prototype.getInfo = function () { cADDRESS.prototype.getInfo = function () {
return { return {
......
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