Commit 0d130a18 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

добавлена NPV.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47362 954022d7-b5bf-4e40-9824-e11837661b57
parent 89185771
...@@ -68,34 +68,34 @@ _func[cElementType.empty] = []; ...@@ -68,34 +68,34 @@ _func[cElementType.empty] = [];
_func[cElementType.array] = []; _func[cElementType.array] = [];
_func[cElementType.number][cElementType.number] = function(arg0,arg1,what){ _func[cElementType.number][cElementType.number] = function (arg0, arg1, what) {
switch (what){ switch (what) {
case ">": case ">":
return new cBool( arg0.getValue() > arg1.getValue() ); return new cBool(arg0.getValue() > arg1.getValue());
case ">=": case ">=":
return new cBool( arg0.getValue() >= arg1.getValue() ); return new cBool(arg0.getValue() >= arg1.getValue());
case "<": case "<":
return new cBool( arg0.getValue() < arg1.getValue() ); return new cBool(arg0.getValue() < arg1.getValue());
case "<=": case "<=":
return new cBool( arg0.getValue() <= arg1.getValue() ); return new cBool(arg0.getValue() <= arg1.getValue());
case "=": case "=":
return new cBool( arg0.getValue() == arg1.getValue() ); return new cBool(arg0.getValue() == arg1.getValue());
case "<>": case "<>":
return new cBool( arg0.getValue() != arg1.getValue() ); return new cBool(arg0.getValue() != arg1.getValue());
case "-": case "-":
return new cNumber( arg0.getValue() - arg1.getValue() ); return new cNumber(arg0.getValue() - arg1.getValue());
case "+": case "+":
return new cNumber( arg0.getValue() + arg1.getValue() ); return new cNumber(arg0.getValue() + arg1.getValue());
case "/": case "/":
if (arg1.getValue() != 0) if (arg1.getValue() != 0)
return new cNumber( arg0.getValue() / arg1.getValue() ); return new cNumber(arg0.getValue() / arg1.getValue());
else else
return new cError( cErrorType.division_by_zero ); return new cError(cErrorType.division_by_zero);
case "*": case "*":
return new cNumber( arg0.getValue() * arg1.getValue() ); return new cNumber(arg0.getValue() * arg1.getValue());
} }
return new cError( cErrorType.wrong_value_type); return new cError(cErrorType.wrong_value_type);
} };
_func[cElementType.number][cElementType.string] = function(arg0,arg1,what){ _func[cElementType.number][cElementType.string] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -116,7 +116,7 @@ _func[cElementType.number][cElementType.string] = function(arg0,arg1,what){ ...@@ -116,7 +116,7 @@ _func[cElementType.number][cElementType.string] = function(arg0,arg1,what){
return new cError( cErrorType.wrong_value_type ); return new cError( cErrorType.wrong_value_type );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.number][cElementType.bool] = function(arg0,arg1,what){ _func[cElementType.number][cElementType.bool] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -151,11 +151,11 @@ _func[cElementType.number][cElementType.bool] = function(arg0,arg1,what){ ...@@ -151,11 +151,11 @@ _func[cElementType.number][cElementType.bool] = function(arg0,arg1,what){
return new cNumber( arg0.getValue() * _arg.getValue() ); return new cNumber( arg0.getValue() * _arg.getValue() );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.number][cElementType.error] = function(arg0,arg1,what){ _func[cElementType.number][cElementType.error] = function(arg0,arg1,what){
return arg1; return arg1;
} };
_func[cElementType.number][cElementType.empty] = function(arg0,arg1,what){ _func[cElementType.number][cElementType.empty] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -181,7 +181,7 @@ _func[cElementType.number][cElementType.empty] = function(arg0,arg1,what){ ...@@ -181,7 +181,7 @@ _func[cElementType.number][cElementType.empty] = function(arg0,arg1,what){
return new cNumber( 0 ); return new cNumber( 0 );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.string][cElementType.number] = function(arg0,arg1,what){ _func[cElementType.string][cElementType.number] = function(arg0,arg1,what){
...@@ -202,7 +202,7 @@ _func[cElementType.string][cElementType.number] = function(arg0,arg1,what){ ...@@ -202,7 +202,7 @@ _func[cElementType.string][cElementType.number] = function(arg0,arg1,what){
return new cError( cErrorType.wrong_value_type ); return new cError( cErrorType.wrong_value_type );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.string][cElementType.string] = function(arg0,arg1,what){ _func[cElementType.string][cElementType.string] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -246,7 +246,7 @@ _func[cElementType.string][cElementType.string] = function(arg0,arg1,what){ ...@@ -246,7 +246,7 @@ _func[cElementType.string][cElementType.string] = function(arg0,arg1,what){
return new cNumber( _arg0.getValue() * _arg1.getValue() ); return new cNumber( _arg0.getValue() * _arg1.getValue() );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.string][cElementType.bool] = function(arg0,arg1,what){ _func[cElementType.string][cElementType.bool] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -288,11 +288,11 @@ _func[cElementType.string][cElementType.bool] = function(arg0,arg1,what){ ...@@ -288,11 +288,11 @@ _func[cElementType.string][cElementType.bool] = function(arg0,arg1,what){
return new cNumber( _arg0.getValue() * _arg1.getValue() ); return new cNumber( _arg0.getValue() * _arg1.getValue() );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.string][cElementType.error] = function(arg0,arg1,what){ _func[cElementType.string][cElementType.error] = function(arg0,arg1,what){
return arg1; return arg1;
} };
_func[cElementType.string][cElementType.empty] = function(arg0,arg1,what){ _func[cElementType.string][cElementType.empty] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -315,7 +315,7 @@ _func[cElementType.string][cElementType.empty] = function(arg0,arg1,what){ ...@@ -315,7 +315,7 @@ _func[cElementType.string][cElementType.empty] = function(arg0,arg1,what){
return new cError( cErrorType.wrong_value_type ); return new cError( cErrorType.wrong_value_type );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.bool][cElementType.number] = function(arg0,arg1,what){ _func[cElementType.bool][cElementType.number] = function(arg0,arg1,what){
...@@ -351,7 +351,7 @@ _func[cElementType.bool][cElementType.number] = function(arg0,arg1,what){ ...@@ -351,7 +351,7 @@ _func[cElementType.bool][cElementType.number] = function(arg0,arg1,what){
return new cNumber( _arg.getValue() * arg1.getValue() ); return new cNumber( _arg.getValue() * arg1.getValue() );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.bool][cElementType.string] = function(arg0,arg1,what){ _func[cElementType.bool][cElementType.string] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -389,7 +389,7 @@ _func[cElementType.bool][cElementType.string] = function(arg0,arg1,what){ ...@@ -389,7 +389,7 @@ _func[cElementType.bool][cElementType.string] = function(arg0,arg1,what){
return new cNumber( _arg0.getValue() * _arg1.getValue() ); return new cNumber( _arg0.getValue() * _arg1.getValue() );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.bool][cElementType.bool] = function(arg0,arg1,what){ _func[cElementType.bool][cElementType.bool] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -425,11 +425,11 @@ _func[cElementType.bool][cElementType.bool] = function(arg0,arg1,what){ ...@@ -425,11 +425,11 @@ _func[cElementType.bool][cElementType.bool] = function(arg0,arg1,what){
return new cNumber( _arg0.getValue() * _arg1.getValue() ); return new cNumber( _arg0.getValue() * _arg1.getValue() );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.bool][cElementType.error] = function(arg0,arg1,what){ _func[cElementType.bool][cElementType.error] = function(arg0,arg1,what){
return arg1; return arg1;
} };
_func[cElementType.bool][cElementType.empty] = function(arg0,arg1,what){ _func[cElementType.bool][cElementType.empty] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -455,14 +455,14 @@ _func[cElementType.bool][cElementType.empty] = function(arg0,arg1,what){ ...@@ -455,14 +455,14 @@ _func[cElementType.bool][cElementType.empty] = function(arg0,arg1,what){
return new cNumber( 0 ); return new cNumber( 0 );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.error][cElementType.number] = _func[cElementType.error][cElementType.string] = _func[cElementType.error][cElementType.number] = _func[cElementType.error][cElementType.string] =
_func[cElementType.error][cElementType.bool] = _func[cElementType.error][cElementType.error] = _func[cElementType.error][cElementType.bool] = _func[cElementType.error][cElementType.error] =
_func[cElementType.error][cElementType.empty] = function(arg0,arg1,what){ _func[cElementType.error][cElementType.empty] = function(arg0,arg1,what){
return arg0; return arg0;
} };
_func[cElementType.empty][cElementType.number] = function(arg0,arg1,what){ _func[cElementType.empty][cElementType.number] = function(arg0,arg1,what){
...@@ -491,7 +491,7 @@ _func[cElementType.empty][cElementType.number] = function(arg0,arg1,what){ ...@@ -491,7 +491,7 @@ _func[cElementType.empty][cElementType.number] = function(arg0,arg1,what){
return new cNumber( 0 ); return new cNumber( 0 );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.empty][cElementType.string] = function(arg0,arg1,what){ _func[cElementType.empty][cElementType.string] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -514,7 +514,7 @@ _func[cElementType.empty][cElementType.string] = function(arg0,arg1,what){ ...@@ -514,7 +514,7 @@ _func[cElementType.empty][cElementType.string] = function(arg0,arg1,what){
return new cError( cErrorType.wrong_value_type ); return new cError( cErrorType.wrong_value_type );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.empty][cElementType.bool] = function(arg0,arg1,what){ _func[cElementType.empty][cElementType.bool] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -542,11 +542,11 @@ _func[cElementType.empty][cElementType.bool] = function(arg0,arg1,what){ ...@@ -542,11 +542,11 @@ _func[cElementType.empty][cElementType.bool] = function(arg0,arg1,what){
return new cNumber( 0 ); return new cNumber( 0 );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.empty][cElementType.error] = function(arg0,arg1,what){ _func[cElementType.empty][cElementType.error] = function(arg0,arg1,what){
return arg1; return arg1;
} };
_func[cElementType.empty][cElementType.empty] = function(arg0,arg1,what){ _func[cElementType.empty][cElementType.empty] = function(arg0,arg1,what){
switch (what){ switch (what){
...@@ -567,7 +567,7 @@ _func[cElementType.empty][cElementType.empty] = function(arg0,arg1,what){ ...@@ -567,7 +567,7 @@ _func[cElementType.empty][cElementType.empty] = function(arg0,arg1,what){
return new cNumber( 0 ); return new cNumber( 0 );
} }
return new cError( cErrorType.wrong_value_type); return new cError( cErrorType.wrong_value_type);
} };
_func[cElementType.cellsRange][cElementType.number] = _func[cElementType.cellsRange][cElementType.string] = _func[cElementType.cellsRange][cElementType.number] = _func[cElementType.cellsRange][cElementType.string] =
...@@ -575,7 +575,7 @@ _func[cElementType.cellsRange][cElementType.bool] = _func[cElementType.cellsRang ...@@ -575,7 +575,7 @@ _func[cElementType.cellsRange][cElementType.bool] = _func[cElementType.cellsRang
_func[cElementType.cellsRange][cElementType.array] = _func[cElementType.cellsRange][cElementType.empty] = function(arg0,arg1,what,cellAddress){ _func[cElementType.cellsRange][cElementType.array] = _func[cElementType.cellsRange][cElementType.empty] = function(arg0,arg1,what,cellAddress){
var cross = arg0.cross(cellAddress); var cross = arg0.cross(cellAddress);
return _func[cross.type][arg1.type](cross,arg1,what) return _func[cross.type][arg1.type](cross,arg1,what)
} };
_func[cElementType.number][cElementType.cellsRange] = _func[cElementType.string][cElementType.cellsRange] = _func[cElementType.number][cElementType.cellsRange] = _func[cElementType.string][cElementType.cellsRange] =
...@@ -583,14 +583,14 @@ _func[cElementType.bool][cElementType.cellsRange] = _func[cElementType.error][cE ...@@ -583,14 +583,14 @@ _func[cElementType.bool][cElementType.cellsRange] = _func[cElementType.error][cE
_func[cElementType.array][cElementType.cellsRange] = _func[cElementType.empty][cElementType.cellsRange] = function(arg0,arg1,what,cellAddress){ _func[cElementType.array][cElementType.cellsRange] = _func[cElementType.empty][cElementType.cellsRange] = function(arg0,arg1,what,cellAddress){
var cross = arg1.cross(cellAddress); var cross = arg1.cross(cellAddress);
return _func[arg0.type][cross.type](arg0,cross,what) return _func[arg0.type][cross.type](arg0,cross,what)
} };
_func[cElementType.cellsRange][cElementType.cellsRange] = function(arg0,arg1,what,cellAddress){ _func[cElementType.cellsRange][cElementType.cellsRange] = function(arg0,arg1,what,cellAddress){
var cross1 = arg0.cross(cellAddress), var cross1 = arg0.cross(cellAddress),
cross2 = arg1.cross(cellAddress); cross2 = arg1.cross(cellAddress);
return _func[cross1.type][cross2.type](cross1,cross2,what) return _func[cross1.type][cross2.type](cross1,cross2,what)
} };
_func[cElementType.array][cElementType.number] = _func[cElementType.array][cElementType.string] = _func[cElementType.array][cElementType.number] = _func[cElementType.array][cElementType.string] =
...@@ -602,7 +602,7 @@ _func[cElementType.array][cElementType.empty] = function(arg0,arg1,what,cellAddr ...@@ -602,7 +602,7 @@ _func[cElementType.array][cElementType.empty] = function(arg0,arg1,what,cellAddr
res.addElement( _func[elem.type][arg1.type](elem,arg1,what) ); res.addElement( _func[elem.type][arg1.type](elem,arg1,what) );
}) })
return res; return res;
} };
_func[cElementType.number][cElementType.array] = _func[cElementType.string][cElementType.array] = _func[cElementType.number][cElementType.array] = _func[cElementType.string][cElementType.array] =
...@@ -612,9 +612,9 @@ _func[cElementType.empty][cElementType.array] = function(arg0,arg1,what,cellAddr ...@@ -612,9 +612,9 @@ _func[cElementType.empty][cElementType.array] = function(arg0,arg1,what,cellAddr
arg1.foreach(function(elem,r,c){ arg1.foreach(function(elem,r,c){
if( !res.array[r] ) res.addRow(); if( !res.array[r] ) res.addRow();
res.addElement( _func[arg0.type][elem.type](arg0,elem,what) ); res.addElement( _func[arg0.type][elem.type](arg0,elem,what) );
}) });
return res; return res;
} };
_func.binarySearch = function(sElem, arrTagert, regExp){ _func.binarySearch = function(sElem, arrTagert, regExp){
...@@ -666,7 +666,7 @@ _func.binarySearch = function(sElem, arrTagert, regExp){ ...@@ -666,7 +666,7 @@ _func.binarySearch = function(sElem, arrTagert, regExp){
return last-1;/* Искомый элемент не найден. Но если вам вдруг надо его вставить со сдвигом, то его место - last. */ return last-1;/* Искомый элемент не найден. Но если вам вдруг надо его вставить со сдвигом, то его место - last. */
} }
} };
/*Functions that checks of an element in formula*/ /*Functions that checks of an element in formula*/
var rx_operators = new RegExp("^ *[-+*/^&%<=>:]"), var rx_operators = new RegExp("^ *[-+*/^&%<=>:]"),
...@@ -2725,6 +2725,72 @@ var cFormulaFunction = { ...@@ -2725,6 +2725,72 @@ var cFormulaFunction = {
'NPV' : function(){ 'NPV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction();
r.setName("NPV"); r.setName("NPV");
r.setArgumentsMin(2);
r.setArgumentsMax(255);
r.Calculate = function(arg){
var arg0 = arg[0], arg1 = arg[1], iStart = 1, res = 0, rate;
function elemCalc(rate,value,step){
return value / Math.pow(1+rate,step);
}
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ){
arg0 = arg0.cross(arguments[1].first);
}
else if( arg0 instanceof cArray ){
arg0 = arg0.getElementRowCol(0,0);
}
arg0 = arg0.tocNumber();
if ( arg0 instanceof cError )
return this.value = arg0;
rate = arg0.getValue();
if( rate == -1)
return this.value = new cError( cErrorType.division_by_zero );
for(var i = 1; i < this.getArguments(); i++){
var argI = arg[i];
if( argI instanceof cArea || argI instanceof cArea3D ){
var argIArr = argI.getValue();
for (var j = 0; j < argIArr.length; j++){
if( argIArr[j] instanceof cNumber ){
res += elemCalc( rate, argIArr[j].getValue(), iStart++ );
}
}
continue;
}
else if( argI instanceof cArray ){
argI.foreach(function(elem,r,c){
if( elem instanceof cNumber ){
res += elemCalc( rate, elem.getValue(), iStart++ );
}
})
continue;
}
argI = argI.tocNumber();
if( argI instanceof cError )
continue;
res += elemCalc( rate, argI.getValue(), iStart++ );
}
return this.value = new cNumber(res);
};
r.getInfo = function(){
return {
name:this.name,
args:"( rate , argument-list )"
};
};
r.setFormat(r.formatType.noneFormat);
return r; return r;
}, },
'ODDFPRICE' : function(){ 'ODDFPRICE' : function(){
...@@ -8574,11 +8640,11 @@ var cFormulaFunction = { ...@@ -8574,11 +8640,11 @@ var cFormulaFunction = {
arg0 = arg0.getElementRowCol(0,0); arg0 = arg0.getElementRowCol(0,0);
} }
arg0 = arg0.tocString();
if ( arg0 instanceof cError ) if ( arg0 instanceof cError )
return this.value = arg0; return this.value = arg0;
arg0 = arg0.tocString();
var res = g_oFormatParser.parse(arg0.getValue()); var res = g_oFormatParser.parse(arg0.getValue());
if( res ) if( res )
...@@ -8624,10 +8690,10 @@ function cNumber(val){ ...@@ -8624,10 +8690,10 @@ function cNumber(val){
this.value = parseFloat(val); this.value = parseFloat(val);
} }
extend(cNumber,cBaseType); extend(cNumber,cBaseType);
cNumber.prototype.getValue = function(){ return this.value.toFixed(cExcelSignificantDigits)-0; } cNumber.prototype.getValue = function(){ return this.value.toFixed(cExcelSignificantDigits)-0; };
cNumber.prototype.tocString = function(){ return new cString( ""+this.value ); } cNumber.prototype.tocString = function(){ return new cString( ""+this.value ); };
cNumber.prototype.tocNumber = function(){ return this; } cNumber.prototype.tocNumber = function(){ return this; };
cNumber.prototype.tocBool = function(){ return new cBool( this.value != 0 ); } cNumber.prototype.tocBool = function(){ return new cBool( this.value != 0 ); };
/** @constructor */ /** @constructor */
function cString(val){ function cString(val){
...@@ -8649,7 +8715,7 @@ cString.prototype.tocNumber = function(){ ...@@ -8649,7 +8715,7 @@ cString.prototype.tocNumber = function(){
if ( !isNaN(_numberValue) ) if ( !isNaN(_numberValue) )
return new cNumber(_numberValue); return new cNumber(_numberValue);
} }
} };
cString.prototype.tocBool = function(){ cString.prototype.tocBool = function(){
if ( parserHelp.isBoolean(this.value, 0) ){ if ( parserHelp.isBoolean(this.value, 0) ){
if( parserHelp.operand_str == "TRUE" ) if( parserHelp.operand_str == "TRUE" )
...@@ -8659,8 +8725,8 @@ cString.prototype.tocBool = function(){ ...@@ -8659,8 +8725,8 @@ cString.prototype.tocBool = function(){
} }
else else
return this; return this;
} };
cString.prototype.tocString = function(){ return this; } cString.prototype.tocString = function(){ return this; };
/** @constructor */ /** @constructor */
function cBool(val){ function cBool(val){
...@@ -8677,12 +8743,12 @@ function cBool(val){ ...@@ -8677,12 +8743,12 @@ function cBool(val){
} }
} }
extend(cBool,cBaseType); extend(cBool,cBaseType);
cBool.prototype.toString = function(){ return this.value.toString().toUpperCase(); } cBool.prototype.toString = function(){ return this.value.toString().toUpperCase(); };
cBool.prototype.getValue = function(){ return this.toString(); } cBool.prototype.getValue = function(){ return this.toString(); };
cBool.prototype.tocNumber = function(){ return new cNumber( this.value ? 1.0: 0.0 ); } cBool.prototype.tocNumber = function(){ return new cNumber( this.value ? 1.0: 0.0 ); };
cBool.prototype.tocString = function(){ return new cString( this.value ? "TRUE": "FALSE" ); } cBool.prototype.tocString = function(){ return new cString( this.value ? "TRUE": "FALSE" ); };
cBool.prototype.tocBool = function(){ return this; } cBool.prototype.tocBool = function(){ return this; };
cBool.prototype.toBool = function(){ return this.value; } cBool.prototype.toBool = function(){ return this.value; };
/** @constructor */ /** @constructor */
function cError(val){ function cError(val){
...@@ -8762,7 +8828,7 @@ function cError(val){ ...@@ -8762,7 +8828,7 @@ function cError(val){
} }
} }
extend(cError,cBaseType); extend(cError,cBaseType);
cError.prototype.tocNumber = cError.prototype.tocString = cError.prototype.tocBool = cError.prototype.tocEmpty = function(){ return this; } cError.prototype.tocNumber = cError.prototype.tocString = cError.prototype.tocBool = cError.prototype.tocEmpty = function(){ return this; };
/** @constructor */ /** @constructor */
function cArea(val,_ws){/*Area means "A1:E5" for example*/ function cArea(val,_ws){/*Area means "A1:E5" for example*/
...@@ -8776,7 +8842,7 @@ function cArea(val,_ws){/*Area means "A1:E5" for example*/ ...@@ -8776,7 +8842,7 @@ function cArea(val,_ws){/*Area means "A1:E5" for example*/
// this._valid = this.range ? true : false; // this._valid = this.range ? true : false;
} }
extend(cArea,cBaseType); extend(cArea,cBaseType);
cArea.prototype.getWsId = function(){ return this.ws.Id; } cArea.prototype.getWsId = function(){ return this.ws.Id; };
cArea.prototype.getValue = function(){ cArea.prototype.getValue = function(){
var _val = [], r = this.getRange(); var _val = [], r = this.getRange();
if( !r ){ if( !r ){
...@@ -8806,7 +8872,7 @@ cArea.prototype.getValue = function(){ ...@@ -8806,7 +8872,7 @@ cArea.prototype.getValue = function(){
} }
}); });
return _val; return _val;
} };
cArea.prototype.getValue2 = function(cell){ cArea.prototype.getValue2 = function(cell){
var _val = [], r = this.getRange(); var _val = [], r = this.getRange();
if( !r ){ if( !r ){
...@@ -8837,19 +8903,19 @@ cArea.prototype.getValue2 = function(cell){ ...@@ -8837,19 +8903,19 @@ cArea.prototype.getValue2 = function(cell){
} }
}); });
return _val[0]; return _val[0];
} };
cArea.prototype.getRange = function(){ return this.ws.getRange2(this._cells); } cArea.prototype.getRange = function(){ return this.ws.getRange2(this._cells); };
cArea.prototype.tocNumber = function(){ return this.getValue()[0].tocNumber(); } cArea.prototype.tocNumber = function(){ return this.getValue()[0].tocNumber(); };
cArea.prototype.tocString = function(){ return this.getValue()[0].tocString(); } cArea.prototype.tocString = function(){ return this.getValue()[0].tocString(); };
cArea.prototype.tocBool = function(){ return this.getValue()[0].tocBool(); } cArea.prototype.tocBool = function(){ return this.getValue()[0].tocBool(); };
cArea.prototype.toString = function(){ return this._cells; } cArea.prototype.toString = function(){ return this._cells; };
cArea.prototype.setRange = function(cell){ cArea.prototype.setRange = function(cell){
this._cells = this.value = cell; this._cells = this.value = cell;
this.range = this.ws.getRange2(cell); this.range = this.ws.getRange2(cell);
this._valid = this.range ? true : false; this._valid = this.range ? true : false;
} };
cArea.prototype.getWS = function(){ return this.ws; } cArea.prototype.getWS = function(){ return this.ws; };
cArea.prototype.getBBox = function(){ return this.getRange().getBBox(); } cArea.prototype.getBBox = function(){ return this.getRange().getBBox(); };
cArea.prototype.cross = function(arg){ cArea.prototype.cross = function(arg){
var r = this.getRange(); var r = this.getRange();
if( !r ) if( !r )
...@@ -8867,13 +8933,13 @@ cArea.prototype.cross = function(arg){ ...@@ -8867,13 +8933,13 @@ cArea.prototype.cross = function(arg){
} }
else else
return new cError( cErrorType.wrong_value_type ); return new cError( cErrorType.wrong_value_type );
} };
cArea.prototype.isValid = function(){ cArea.prototype.isValid = function(){
var r = this.getRange(); var r = this.getRange();
if(!r) if(!r)
return false; return false;
return true; return true;
} };
cArea.prototype.countCells = function(){ cArea.prototype.countCells = function(){
var r = this.getRange(), bbox = r.bbox, var r = this.getRange(), bbox = r.bbox,
count = (Math.abs(bbox.c1 - bbox.c2) + 1)*(Math.abs(bbox.r1 - bbox.r2) + 1); count = (Math.abs(bbox.c1 - bbox.c2) + 1)*(Math.abs(bbox.r1 - bbox.r2) + 1);
...@@ -8881,7 +8947,7 @@ cArea.prototype.countCells = function(){ ...@@ -8881,7 +8947,7 @@ cArea.prototype.countCells = function(){
count--; count--;
}) })
return new cNumber( count ); return new cNumber( count );
} };
/** @constructor */ /** @constructor */
function cRef(val,_ws){/*Ref means A1 for example*/ function cRef(val,_ws){/*Ref means A1 for example*/
...@@ -8895,7 +8961,7 @@ function cRef(val,_ws){/*Ref means A1 for example*/ ...@@ -8895,7 +8961,7 @@ function cRef(val,_ws){/*Ref means A1 for example*/
this._valid = new CellAddress(val.replace(/\$/g,"")).isValid(); this._valid = new CellAddress(val.replace(/\$/g,"")).isValid();
} }
extend(cRef,cBaseType); extend(cRef,cBaseType);
cRef.prototype.getWsId = function(){ return this.ws.Id; } cRef.prototype.getWsId = function(){ return this.ws.Id; };
cRef.prototype.getValue = function(){ cRef.prototype.getValue = function(){
if( !this._valid ){ if( !this._valid ){
return new cError(cErrorType.bad_reference) return new cError(cErrorType.bad_reference)
...@@ -8926,17 +8992,17 @@ cRef.prototype.getValue = function(){ ...@@ -8926,17 +8992,17 @@ cRef.prototype.getValue = function(){
return new cError(parserHelp.operand_str) return new cError(parserHelp.operand_str)
else return new cString(_val); else return new cString(_val);
} }
} };
cRef.prototype.tocNumber = function(){ return this.getValue().tocNumber(); } cRef.prototype.tocNumber = function(){ return this.getValue().tocNumber(); };
cRef.prototype.tocString = function(){ return new cString(""+this.range.getValueWithFormat()); } cRef.prototype.tocString = function(){ return new cString(""+this.range.getValueWithFormat()); };
cRef.prototype.tocBool = function(){ return this.getValue().tocBool(); } cRef.prototype.tocBool = function(){ return this.getValue().tocBool(); };
cRef.prototype.tryConvert = function(){ return this.getValue(); } cRef.prototype.tryConvert = function(){ return this.getValue(); };
cRef.prototype.toString = function(){ return this._cells; } cRef.prototype.toString = function(){ return this._cells; };
cRef.prototype.getRange = function(){ return this.range; } cRef.prototype.getRange = function(){ return this.range; };
cRef.prototype.getWS = function(){ return this.ws; } cRef.prototype.getWS = function(){ return this.ws; };
cRef.prototype.isValid = function(){ cRef.prototype.isValid = function(){
return this._valid; return this._valid;
} };
/** @constructor */ /** @constructor */
function cArea3D(val,_wsFrom, _wsTo,wb){/*Area3D means "Sheat1!A1:E5" for example*/ function cArea3D(val,_wsFrom, _wsTo,wb){/*Area3D means "Sheat1!A1:E5" for example*/
...@@ -8969,7 +9035,7 @@ cArea3D.prototype.range = function(wsRange){ ...@@ -8969,7 +9035,7 @@ cArea3D.prototype.range = function(wsRange){
} }
return r; return r;
}; };
cArea3D.prototype.getRange = function(){ return this.range(this.wsRange()); } cArea3D.prototype.getRange = function(){ return this.range(this.wsRange()); };
cArea3D.prototype.getValue = function(){ cArea3D.prototype.getValue = function(){
var _wsA = this.wsRange(); var _wsA = this.wsRange();
var _val = []; var _val = [];
...@@ -9014,7 +9080,7 @@ cArea3D.prototype.getValue = function(){ ...@@ -9014,7 +9080,7 @@ cArea3D.prototype.getValue = function(){
}) })
} }
return _val; return _val;
} };
cArea3D.prototype.getValue2 = function(cell){ cArea3D.prototype.getValue2 = function(cell){
var _wsA = this.wsRange(); var _wsA = this.wsRange();
var _val = []; var _val = [];
...@@ -9058,7 +9124,7 @@ cArea3D.prototype.getValue2 = function(cell){ ...@@ -9058,7 +9124,7 @@ cArea3D.prototype.getValue2 = function(cell){
} }
}) })
return _val[0]; return _val[0];
} };
cArea3D.prototype.changeSheet = function(lastName,newName){ cArea3D.prototype.changeSheet = function(lastName,newName){
if( this.wsFrom == this._wb.getWorksheetByName(lastName).getId() && this.wsTo == this._wb.getWorksheetByName(lastName).getId() ){ if( this.wsFrom == this._wb.getWorksheetByName(lastName).getId() && this.wsTo == this._wb.getWorksheetByName(lastName).getId() ){
this.wsFrom = this.wsTo = this._wb.getWorksheetByName(newName).getId(); this.wsFrom = this.wsTo = this._wb.getWorksheetByName(newName).getId();
...@@ -9069,7 +9135,7 @@ cArea3D.prototype.changeSheet = function(lastName,newName){ ...@@ -9069,7 +9135,7 @@ cArea3D.prototype.changeSheet = function(lastName,newName){
else if( this.wsTo == this._wb.getWorksheetByName(lastName).getId() ){ else if( this.wsTo == this._wb.getWorksheetByName(lastName).getId() ){
this.wsTo = this._wb.getWorksheetByName(newName).getId(); this.wsTo = this._wb.getWorksheetByName(newName).getId();
} }
} };
cArea3D.prototype.moveSheet = function(tempW){ cArea3D.prototype.moveSheet = function(tempW){
if( this.wsFrom == this.wsTo ){ if( this.wsFrom == this.wsTo ){
return; return;
...@@ -9088,7 +9154,7 @@ cArea3D.prototype.moveSheet = function(tempW){ ...@@ -9088,7 +9154,7 @@ cArea3D.prototype.moveSheet = function(tempW){
this.wsTo = this._wb.getWorksheet(tempW.wFI).getId(); this.wsTo = this._wb.getWorksheet(tempW.wFI).getId();
} }
} }
} };
cArea3D.prototype.toString = function(){ cArea3D.prototype.toString = function(){
var wsFrom = this._wb.getWorksheetById( this.wsFrom ).getName(); var wsFrom = this._wb.getWorksheetById( this.wsFrom ).getName();
var wsTo = this._wb.getWorksheetById( this.wsTo ).getName(); var wsTo = this._wb.getWorksheetById( this.wsTo ).getName();
...@@ -9104,11 +9170,11 @@ cArea3D.prototype.toString = function(){ ...@@ -9104,11 +9170,11 @@ cArea3D.prototype.toString = function(){
wsFrom+":"+wsTo : wsFrom+":"+wsTo :
wsFrom) wsFrom)
+"!"+this._cells; +"!"+this._cells;
} };
cArea3D.prototype.tocNumber = function(){ return this.getValue()[0].tocNumber(); } cArea3D.prototype.tocNumber = function(){ return this.getValue()[0].tocNumber(); };
cArea3D.prototype.tocString = function(){ return this.getValue()[0].tocString(); } cArea3D.prototype.tocString = function(){ return this.getValue()[0].tocString(); };
cArea3D.prototype.tocBool = function(){ return this.getValue()[0].tocBool(); } cArea3D.prototype.tocBool = function(){ return this.getValue()[0].tocBool(); };
cArea3D.prototype.getWS = function(){ return this.wsRange()[0]; } cArea3D.prototype.getWS = function(){ return this.wsRange()[0]; };
cArea3D.prototype.cross = function(arg){ cArea3D.prototype.cross = function(arg){
if( this.wsFrom != this.wsTo ) if( this.wsFrom != this.wsTo )
return new cError( cErrorType.wrong_value_type ); return new cError( cErrorType.wrong_value_type );
...@@ -9128,8 +9194,8 @@ cArea3D.prototype.cross = function(arg){ ...@@ -9128,8 +9194,8 @@ cArea3D.prototype.cross = function(arg){
} }
else else
return new cError( cErrorType.wrong_value_type ); return new cError( cErrorType.wrong_value_type );
} };
cArea3D.prototype.getBBox = function(){ return this.getRange()[0].getBBox(); } cArea3D.prototype.getBBox = function(){ return this.getRange()[0].getBBox(); };
cArea3D.prototype.isValid = function(){ cArea3D.prototype.isValid = function(){
var r = this.getRange(); var r = this.getRange();
for( var i=0;i<r.length;i++){ for( var i=0;i<r.length;i++){
...@@ -9137,7 +9203,7 @@ cArea3D.prototype.isValid = function(){ ...@@ -9137,7 +9203,7 @@ cArea3D.prototype.isValid = function(){
return false; return false;
} }
return true; return true;
} };
cArea3D.prototype.countCells = function(){ cArea3D.prototype.countCells = function(){
var _wsA = this.wsRange(); var _wsA = this.wsRange();
var _val = []; var _val = [];
...@@ -9166,7 +9232,7 @@ cArea3D.prototype.countCells = function(){ ...@@ -9166,7 +9232,7 @@ cArea3D.prototype.countCells = function(){
}) })
} }
return new cNumber( count ); return new cNumber( count );
} };
/** @constructor */ /** @constructor */
function cRef3D(val,_wsFrom,wb){/*Ref means Sheat1!A1 for example*/ function cRef3D(val,_wsFrom,wb){/*Ref means Sheat1!A1 for example*/
...@@ -9178,18 +9244,18 @@ function cRef3D(val,_wsFrom,wb){/*Ref means Sheat1!A1 for example*/ ...@@ -9178,18 +9244,18 @@ function cRef3D(val,_wsFrom,wb){/*Ref means Sheat1!A1 for example*/
this.ws = this._wb.getWorksheetByName( _wsFrom ); this.ws = this._wb.getWorksheetByName( _wsFrom );
} }
extend(cRef3D,cBaseType); extend(cRef3D,cBaseType);
cRef3D.prototype.getWsId = function(){ return this.ws.Id; } cRef3D.prototype.getWsId = function(){ return this.ws.Id; };
cRef3D.prototype.getRange = function(){ cRef3D.prototype.getRange = function(){
if(this.ws) if(this.ws)
return this.ws.getRange2(this._cells); return this.ws.getRange2(this._cells);
else else
return null; return null;
} };
cRef3D.prototype.isValid = function(){ cRef3D.prototype.isValid = function(){
if( this.getRange() ) if( this.getRange() )
return true; return true;
else return false; else return false;
} };
cRef3D.prototype.getValue = function(){ cRef3D.prototype.getValue = function(){
var _r = this.getRange(); var _r = this.getRange();
if( !_r ){ if( !_r ){
...@@ -9221,16 +9287,16 @@ cRef3D.prototype.getValue = function(){ ...@@ -9221,16 +9287,16 @@ cRef3D.prototype.getValue = function(){
return new cError(parserHelp.operand_str) return new cError(parserHelp.operand_str)
else return new cString(_val); else return new cString(_val);
} }
} };
cRef3D.prototype.tocBool = function(){ return this.getValue().tocBool(); } cRef3D.prototype.tocBool = function(){ return this.getValue().tocBool(); };
cRef3D.prototype.tocNumber = function(){ return this.getValue().tocNumber(); } cRef3D.prototype.tocNumber = function(){ return this.getValue().tocNumber(); };
cRef3D.prototype.tocString = function(){ return this.getValue().tocString(); } cRef3D.prototype.tocString = function(){ return this.getValue().tocString(); };
cRef3D.prototype.tryConvert = function(){ return this.getValue(); } cRef3D.prototype.tryConvert = function(){ return this.getValue(); };
cRef3D.prototype.changeSheet = function(lastName,newName){ cRef3D.prototype.changeSheet = function(lastName,newName){
if( this.ws.getName() == lastName ){ if( this.ws.getName() == lastName ){
this.ws = this._wb.getWorksheetByName( newName ); this.ws = this._wb.getWorksheetByName( newName );
} }
} };
cRef3D.prototype.toString = function(){ cRef3D.prototype.toString = function(){
var wsName = this.ws.getName(); var wsName = this.ws.getName();
if( !rx_test_ws_name.test(wsName) ){ if( !rx_test_ws_name.test(wsName) ){
...@@ -9239,8 +9305,8 @@ cRef3D.prototype.toString = function(){ ...@@ -9239,8 +9305,8 @@ cRef3D.prototype.toString = function(){
else{ else{
return wsName+"!"+this._cells; return wsName+"!"+this._cells;
} }
} };
cRef3D.prototype.getWS = function(){ return this.ws; } cRef3D.prototype.getWS = function(){ return this.ws; };
/** @constructor */ /** @constructor */
function cEmpty(){ function cEmpty(){
...@@ -9248,10 +9314,10 @@ function cEmpty(){ ...@@ -9248,10 +9314,10 @@ function cEmpty(){
this.type = cElementType.empty; this.type = cElementType.empty;
} }
extend(cEmpty,cBaseType); extend(cEmpty,cBaseType);
cEmpty.prototype.tocNumber = function(){ return new cNumber(0); } cEmpty.prototype.tocNumber = function(){ return new cNumber(0); };
cEmpty.prototype.tocBool = function(){ return new cBool(false); } cEmpty.prototype.tocBool = function(){ return new cBool(false); };
cEmpty.prototype.tocString = function(){ return new cString(""); } cEmpty.prototype.tocString = function(){ return new cString(""); };
cEmpty.prototype.toString = function(){ return ""; } cEmpty.prototype.toString = function(){ return ""; };
/** @constructor */ /** @constructor */
function cName(val,wb){ function cName(val,wb){
...@@ -9268,16 +9334,14 @@ cName.prototype.toRef = function(wsID){ ...@@ -9268,16 +9334,14 @@ cName.prototype.toRef = function(wsID){
_wsFrom = _3DRefTmp[1]; _wsFrom = _3DRefTmp[1];
_wsTo = ( (_3DRefTmp[2] !== null) && (_3DRefTmp[2] !== undefined) )? _3DRefTmp[2] : _wsFrom; _wsTo = ( (_3DRefTmp[2] !== null) && (_3DRefTmp[2] !== undefined) )? _3DRefTmp[2] : _wsFrom;
if ( parserHelp.isArea(ref,ref.indexOf("!")+1) ){ if ( parserHelp.isArea(ref,ref.indexOf("!")+1) ){
var r = new cArea3D(parserHelp.operand_str,_wsFrom, _wsTo, this.wb); return new cArea3D(parserHelp.operand_str,_wsFrom, _wsTo, this.wb);
return r;
} }
else if ( parserHelp.isRef(ref,ref.indexOf("!")+1) ){ else if ( parserHelp.isRef(ref,ref.indexOf("!")+1) ){
var r = new cRef3D(parserHelp.operand_str,_wsFrom,this.wb); return new cRef3D(parserHelp.operand_str,_wsFrom,this.wb);
return r;
} }
} }
return new cError("#REF!"); return new cError("#REF!");
} };
/** @constructor */ /** @constructor */
function cArray(){ function cArray(){
...@@ -9292,7 +9356,7 @@ extend(cArray,cBaseType); ...@@ -9292,7 +9356,7 @@ extend(cArray,cBaseType);
cArray.prototype.addRow = function(){ cArray.prototype.addRow = function(){
this.array[this.array.length] = []; this.array[this.array.length] = [];
this.countElementInRow[this.rowCount++] = 0; this.countElementInRow[this.rowCount++] = 0;
} };
cArray.prototype.addElement = function(element){ cArray.prototype.addElement = function(element){
if( this.array.length == 0){ if( this.array.length == 0){
this.addRow(); this.addRow();
...@@ -9302,24 +9366,24 @@ cArray.prototype.addElement = function(element){ ...@@ -9302,24 +9366,24 @@ cArray.prototype.addElement = function(element){
subArr[subArr.length] = element; subArr[subArr.length] = element;
this.countElementInRow[this.rowCount-1]++; this.countElementInRow[this.rowCount-1]++;
this.countElement++; this.countElement++;
} };
cArray.prototype.getRow = function(rowIndex){ cArray.prototype.getRow = function(rowIndex){
if( rowIndex < 0 || rowIndex > this.array.length-1 ) if( rowIndex < 0 || rowIndex > this.array.length-1 )
return null; return null;
return this.array[rowIndex]; return this.array[rowIndex];
} };
cArray.prototype.getCol = function(colIndex){ cArray.prototype.getCol = function(colIndex){
var col = []; var col = [];
for( var i = 0; i < this.rowCount; i++){ for( var i = 0; i < this.rowCount; i++){
col.push(this.array[i][colIndex]) col.push(this.array[i][colIndex])
} }
return col; return col;
} };
cArray.prototype.getElementRowCol = function(row,col){ cArray.prototype.getElementRowCol = function(row,col){
if( row > this.rowCount || col > this.getCountElementInRow() ) if( row > this.rowCount || col > this.getCountElementInRow() )
return new cError( cErrorType.not_available ); return new cError( cErrorType.not_available );
return this.array[row][col]; return this.array[row][col];
} };
cArray.prototype.getElement = function(index){ cArray.prototype.getElement = function(index){
for( var i = 0; i < this.rowCount; i++){ for( var i = 0; i < this.rowCount; i++){
if( index > this.countElementInRow[i].length ) if( index > this.countElementInRow[i].length )
...@@ -9328,7 +9392,7 @@ cArray.prototype.getElement = function(index){ ...@@ -9328,7 +9392,7 @@ cArray.prototype.getElement = function(index){
return this.array[i][index]; return this.array[i][index];
} }
return null; return null;
} };
cArray.prototype.foreach = function(action){ cArray.prototype.foreach = function(action){
if( typeof (action) != 'function' ){ return; } if( typeof (action) != 'function' ){ return; }
for( var ir = 0; ir < this.rowCount; ir++ ){ for( var ir = 0; ir < this.rowCount; ir++ ){
...@@ -9337,10 +9401,12 @@ cArray.prototype.foreach = function(action){ ...@@ -9337,10 +9401,12 @@ cArray.prototype.foreach = function(action){
return true; return true;
} }
} }
} };
cArray.prototype.getCountElement = function(){ return this.countElement; } cArray.prototype.getCountElement = function(){ return this.countElement; };
cArray.prototype.getCountElementInRow = function(){ return this.countElementInRow[0]; } cArray.prototype.getCountElementInRow = function(){ return this.countElementInRow[0]; };
cArray.prototype.getRowCount = function(){ return this.rowCount; } cArray.prototype.getRowCount = function () {
return this.rowCount;
};
cArray.prototype.tocNumber = function(){ cArray.prototype.tocNumber = function(){
var retArr = new cArray(); var retArr = new cArray();
for( var ir = 0; ir < this.rowCount; ir++,retArr.addRow()){ for( var ir = 0; ir < this.rowCount; ir++,retArr.addRow()){
...@@ -9351,7 +9417,7 @@ cArray.prototype.tocNumber = function(){ ...@@ -9351,7 +9417,7 @@ cArray.prototype.tocNumber = function(){
break; break;
} }
return retArr; return retArr;
} };
cArray.prototype.tocString = function(){ cArray.prototype.tocString = function(){
var retArr = new cArray(); var retArr = new cArray();
for( var ir = 0; ir < this.rowCount; ir++,retArr.addRow()){ for( var ir = 0; ir < this.rowCount; ir++,retArr.addRow()){
...@@ -9362,7 +9428,7 @@ cArray.prototype.tocString = function(){ ...@@ -9362,7 +9428,7 @@ cArray.prototype.tocString = function(){
break; break;
} }
return retArr; return retArr;
} };
cArray.prototype.tocBool = function(){ cArray.prototype.tocBool = function(){
var retArr = new cArray(); var retArr = new cArray();
for( var ir = 0; ir < this.rowCount; ir++,retArr.addRow()){ for( var ir = 0; ir < this.rowCount; ir++,retArr.addRow()){
...@@ -9373,7 +9439,7 @@ cArray.prototype.tocBool = function(){ ...@@ -9373,7 +9439,7 @@ cArray.prototype.tocBool = function(){
break; break;
} }
return retArr; return retArr;
} };
cArray.prototype.toString = function(){ cArray.prototype.toString = function(){
var ret=""; var ret="";
for( var ir = 0; ir < this.rowCount; ir++,ret+=";" ){ for( var ir = 0; ir < this.rowCount; ir++,ret+=";" ){
...@@ -9388,9 +9454,9 @@ cArray.prototype.toString = function(){ ...@@ -9388,9 +9454,9 @@ cArray.prototype.toString = function(){
ret = ret.substring(0,ret.length-1) ret = ret.substring(0,ret.length-1)
} }
if ( ret[ret.length-1]==";") if ( ret[ret.length-1]==";")
ret = ret.substring(0,ret.length-1) ret = ret.substring(0, ret.length - 1);
return "{"+ret+"}"; return "{"+ret+"}";
} };
cArray.prototype.isValidArray = function(){ cArray.prototype.isValidArray = function(){
for( var i = 0; i < this.rowCount-1; i++){ for( var i = 0; i < this.rowCount-1; i++){
if( this.countElementInRow[i] - this.countElementInRow[i+1] == 0) if( this.countElementInRow[i] - this.countElementInRow[i+1] == 0)
...@@ -9399,7 +9465,7 @@ cArray.prototype.isValidArray = function(){ ...@@ -9399,7 +9465,7 @@ cArray.prototype.isValidArray = function(){
return false; return false;
} }
return true; return true;
} };
/** класс отвечающий за парсинг строки с формулой, подсчета формулы, перестройки формулы при манипуляции с ячейкой*/ /** класс отвечающий за парсинг строки с формулой, подсчета формулы, перестройки формулы при манипуляции с ячейкой*/
/** @constructor */ /** @constructor */
...@@ -10109,8 +10175,7 @@ parserFormula.prototype = { ...@@ -10109,8 +10175,7 @@ parserFormula.prototype = {
r = ref.getRange(); r = ref.getRange();
r.setOffset({offsetCol:0, offsetRow:offset.offsetRow}); r.setOffset({offsetCol:0, offsetRow:offset.offsetRow});
ref.value = ref._cells = "$"+r.first.getID(); ref.value = ref._cells = "$"+r.first.getID();
} } else{
else{
r = ref.getRange(); r = ref.getRange();
r.setOffset({offsetCol:offset.offsetCol, offsetRow:0}); r.setOffset({offsetCol:offset.offsetCol, offsetRow:0});
ref.value = ref._cells = r.first.getColLetter()+"$"+r.first.getRow(); ref.value = ref._cells = r.first.getColLetter()+"$"+r.first.getRow();
......
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