Commit 35824c41 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 20137

ToDo move definition A1 or R1C1 reference style to Range
parent c8dde242
...@@ -169,31 +169,42 @@ ...@@ -169,31 +169,42 @@
rowNumber = rowNumber.getValue(); rowNumber = rowNumber.getValue();
colNumber = colNumber.getValue(); colNumber = colNumber.getValue();
refType = refType.getValue(); refType = refType.getValue();
A1RefType = A1RefType.getValue(); A1RefType = A1RefType.toBool();
if (refType > 4 || refType < 1 || rowNumber < 1 || rowNumber > AscCommon.gc_nMaxRow || colNumber < 1 || if (refType > 4 || refType < 1 || rowNumber < 1 || rowNumber > AscCommon.gc_nMaxRow || colNumber < 1 ||
colNumber > AscCommon.gc_nMaxCol) { colNumber > AscCommon.gc_nMaxCol) {
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 strRow;
switch (refType) { switch (refType) {
case 1: case 1:
strRef = "$" + g_oCellAddressUtils.colnumToColstrFromWsView(colNumber) + "$" + rowNumber; strRow = this._absolute(rowNumber, A1RefType);
strColumn = this._absolute(strColumn, A1RefType);
break; break;
case 2: case 2:
strRef = g_oCellAddressUtils.colnumToColstrFromWsView(colNumber) + "$" + rowNumber; strRow = this._absolute(rowNumber, A1RefType);
break; break;
case 3: case 3:
strRef = "$" + g_oCellAddressUtils.colnumToColstrFromWsView(colNumber) + rowNumber; strColumn = this._absolute(strColumn, A1RefType);
strRow = rowNumber;
break; break;
case 4: case 4:
strRef = g_oCellAddressUtils.colnumToColstrFromWsView(colNumber) + rowNumber; strRow = rowNumber;
break; break;
} }
strRef = this._getRef(strRow, strColumn, 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));
}; };
cADDRESS.prototype._getRef = function (row, col, A1RefType) {
return A1RefType ? col + row : 'R' + row + 'C' + col;
};
cADDRESS.prototype._absolute = function (val, A1RefType) {
return A1RefType ? '$' + val : '[' + val + ']';
};
cADDRESS.prototype.getInfo = function () { cADDRESS.prototype.getInfo = function () {
return { return {
name: this.name, name: this.name,
......
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