Commit 3dc83516 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

PMT, COLUMNS, ROWS

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47444 954022d7-b5bf-4e40-9824-e11837661b57
parent 1f03e2fd
...@@ -906,4 +906,34 @@ ...@@ -906,4 +906,34 @@
}) })
test("Test: \"PMT\"",function(){
function pmt( rate, nper, pv, fv, type ){
var res;
if( type === undefined || type === null )
type = 0;
if( fv === undefined || fv === null )
fv = 0;
if( rate != 0 ){
res = -1*( pv * Math.pow( 1 + rate, nper ) + fv ) /
( ( 1 + rate * type ) * ( Math.pow( 1 + rate, nper ) - 1 ) / rate );
}
else{
res = -1*( pv + fv )/ nper;
}
return res;
}
oParser = new parserFormula("PMT(0.08/12,10,10000)","A2",ws);
ok(oParser.parse());
ok( Math.abs(oParser.calculate().getValue() - pmt(0.08/12,10,10000)) < dif );
oParser = new parserFormula("PMT(0.08/12,10,10000,0,1)","A2",ws);
ok(oParser.parse());
ok( Math.abs(oParser.calculate().getValue() - pmt(0.08/12,10,10000,0,1)) < dif );
})
}); });
...@@ -4455,6 +4455,20 @@ Range.prototype._foreach=function(action){ ...@@ -4455,6 +4455,20 @@ Range.prototype._foreach=function(action){
} }
} }
}; };
Range.prototype._foreach2=function(action){
if(null != action)
{
var oBBox = this.bbox, minC = Math.min( this.worksheet.getColsCount(), oBBox.c2 ), minR = Math.min( this.worksheet.getRowsCount(), oBBox.r2 );
for(var i = oBBox.r1; i <= minR; i++){
for(var j = oBBox.c1; j <= minC; j++){
var oCurCell = this.worksheet._getCellNoEmpty(i, j);
var oRes = action(oCurCell, i, j, oBBox.r1, oBBox.c1);
if(null != oRes)
return oRes;
}
}
}
};
Range.prototype._foreachNoEmpty=function(action){ Range.prototype._foreachNoEmpty=function(action){
if(null != action) if(null != action)
{ {
......
...@@ -1082,8 +1082,8 @@ cBaseOperator.prototype = { ...@@ -1082,8 +1082,8 @@ cBaseOperator.prototype = {
} }
/** @constructor */ /** @constructor */
function cBaseFunction(){ function cBaseFunction(name){
this.name = null; this.name = name;
this.type = cElementType.func; this.type = cElementType.func;
this.value = null; this.value = null;
this.argumentsMin = 0; this.argumentsMin = 0;
...@@ -1407,111 +1407,91 @@ var cFormulaFunction = { ...@@ -1407,111 +1407,91 @@ var cFormulaFunction = {
Cube : { Cube : {
'groupName' : "Cube", 'groupName' : "Cube",
'CUBEKPIMEMBER' : function(){ 'CUBEKPIMEMBER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUBEKPIMEMBER");
r.setName("CUBEKPIMEMBER");
return r; return r;
}, },
'CUBEMEMBER' : function(){ 'CUBEMEMBER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUBEMEMBER");
r.setName("CUBEMEMBER");
return r; return r;
}, },
'CUBEMEMBERPROPERTY' : function(){ 'CUBEMEMBERPROPERTY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUBEMEMBERPROPERTY");
r.setName("CUBEMEMBERPROPERTY");
return r; return r;
}, },
'CUBERANKEDMEMBER' : function(){ 'CUBERANKEDMEMBER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUBERANKEDMEMBER");
r.setName("CUBERANKEDMEMBER");
return r; return r;
}, },
'CUBESET' : function(){ 'CUBESET' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUBESET");
r.setName("CUBESET");
return r; return r;
}, },
'CUBESETCOUNT' : function(){ 'CUBESETCOUNT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUBESETCOUNT");
r.setName("CUBESETCOUNT");
return r; return r;
}, },
'CUBEVALUE' : function(){ 'CUBEVALUE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUBEVALUE");
r.setName("CUBEVALUE");
return r; return r;
} }
}, },
Database : { Database : {
'groupName' : "Database", 'groupName' : "Database",
'DAVERAGE' : function(){ 'DAVERAGE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DAVERAGE");
r.setName("DAVERAGE");
return r; return r;
}, },
'DCOUNT' : function(){ 'DCOUNT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DCOUNT");
r.setName("DCOUNT");
return r; return r;
}, },
'DCOUNTA' : function(){ 'DCOUNTA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DCOUNTA");
r.setName("DCOUNTA");
return r; return r;
}, },
'DGET' : function(){ 'DGET' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DGET");
r.setName("DGET");
return r; return r;
}, },
'DMAX' : function(){ 'DMAX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DMAX");
r.setName("DMAX");
return r; return r;
}, },
'DMIN' : function(){ 'DMIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DMIN");
r.setName("DMIN");
return r; return r;
}, },
'DPRODUCT' : function(){ 'DPRODUCT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DPRODUCT");
r.setName("DPRODUCT");
return r; return r;
}, },
'DSTDEV' : function(){ 'DSTDEV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DSTDEV");
r.setName("DSTDEV");
return r; return r;
}, },
'DSTDEVP' : function(){ 'DSTDEVP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DSTDEVP");
r.setName("DSTDEVP");
return r; return r;
}, },
'DSUM' : function(){ 'DSUM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DSUM");
r.setName("DSUM");
return r; return r;
}, },
'DVAR' : function(){ 'DVAR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DVAR");
r.setName("DVAR");
return r; return r;
}, },
'DVARP' : function(){ 'DVARP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DVARP");
r.setName("DVARP");
return r; return r;
} }
}, },
DateAndTime : { DateAndTime : {
'groupName' : "DateAndTime", 'groupName' : "DateAndTime",
'DATE' : function(){ 'DATE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DATE");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.setName("DATE");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2], year, month, day; var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2], year, month, day;
...@@ -1576,13 +1556,11 @@ var cFormulaFunction = { ...@@ -1576,13 +1556,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'DATEDIF' : function(){ 'DATEDIF' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DATEDIF");
r.setName("DATEDIF");
return r; return r;
}, },
'DATEVALUE' : function(){ 'DATEVALUE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DATEVALUE");
r.setName("DATEVALUE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -1620,10 +1598,9 @@ var cFormulaFunction = { ...@@ -1620,10 +1598,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'DAY' : function(){ 'DAY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DAY");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.setName("DAY");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],val; var arg0 = arg[0],val;
if( arg0 instanceof cArray ){ if( arg0 instanceof cArray ){
...@@ -1684,13 +1661,11 @@ var cFormulaFunction = { ...@@ -1684,13 +1661,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'DAYS360' : function(){ 'DAYS360' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DAYS360");
r.setName("DAYS360");
return r; return r;
}, },
'EDATE' : function(){ 'EDATE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("EDATE");
r.setName("EDATE");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -1757,8 +1732,7 @@ var cFormulaFunction = { ...@@ -1757,8 +1732,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'EOMONTH' : function(){ 'EOMONTH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("EOMONTH");
r.setName("EOMONTH");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -1817,10 +1791,9 @@ var cFormulaFunction = { ...@@ -1817,10 +1791,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'HOUR' : function(){ 'HOUR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HOUR");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.setName("HOUR");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],val; var arg0 = arg[0],val;
if( arg0 instanceof cArray ){ if( arg0 instanceof cArray ){
...@@ -1877,10 +1850,9 @@ var cFormulaFunction = { ...@@ -1877,10 +1850,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'MINUTE' : function(){ 'MINUTE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MINUTE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.setName("MINUTE");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],val; var arg0 = arg[0],val;
if( arg0 instanceof cArray ){ if( arg0 instanceof cArray ){
...@@ -1939,10 +1911,9 @@ var cFormulaFunction = { ...@@ -1939,10 +1911,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'MONTH' : function(){ 'MONTH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MONTH");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.setName("MONTH");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],val; var arg0 = arg[0],val;
if( arg0 instanceof cArray ){ if( arg0 instanceof cArray ){
...@@ -2002,8 +1973,7 @@ var cFormulaFunction = { ...@@ -2002,8 +1973,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'NETWORKDAYS' : function(){ 'NETWORKDAYS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NETWORKDAYS");
r.setName("NETWORKDAYS");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -2124,15 +2094,13 @@ var cFormulaFunction = { ...@@ -2124,15 +2094,13 @@ var cFormulaFunction = {
return r; return r;
}, },
'NETWORKDAYS.INTL' : function(){ 'NETWORKDAYS.INTL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NETWORKDAYS.INTL");
r.setName("NETWORKDAYS.INTL");
return r; return r;
}, },
'NOW' : function(){ 'NOW' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NOW");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(0); r.setArgumentsMax(0);
r.setName("NOW");
r.Calculate = function(){ r.Calculate = function(){
var d = new Date(); var d = new Date();
this.value = new cNumber( Math.floor( ( d.getTime()/1000 - d.getTimezoneOffset()*60 )/c_sPerDay+(c_DateCorrectConst+1) ) + ( (d.getHours()*60*60+d.getMinutes()*60+d.getSeconds())/c_sPerDay ) ); this.value = new cNumber( Math.floor( ( d.getTime()/1000 - d.getTimezoneOffset()*60 )/c_sPerDay+(c_DateCorrectConst+1) ) + ( (d.getHours()*60*60+d.getMinutes()*60+d.getSeconds())/c_sPerDay ) );
...@@ -2148,10 +2116,9 @@ var cFormulaFunction = { ...@@ -2148,10 +2116,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'SECOND' : function(){ 'SECOND' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SECOND");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.setName("SECOND");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],val; var arg0 = arg[0],val;
if( arg0 instanceof cArray ){ if( arg0 instanceof cArray ){
...@@ -2210,10 +2177,9 @@ var cFormulaFunction = { ...@@ -2210,10 +2177,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'TIME' : function(){ 'TIME' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TIME");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.setName("TIME");
//to excel (hh*60*60+mm*60+ss)/c_sPerDay (c_sPerDay the number of seconds in a day) //to excel (hh*60*60+mm*60+ss)/c_sPerDay (c_sPerDay the number of seconds in a day)
r.Calculate = function(arg){ r.Calculate = function(arg){
var hour,minute,second; var hour,minute,second;
...@@ -2269,15 +2235,13 @@ var cFormulaFunction = { ...@@ -2269,15 +2235,13 @@ var cFormulaFunction = {
return r; return r;
}, },
'TIMEVALUE' : function(){ 'TIMEVALUE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TIMEVALUE");
r.setName("TIMEVALUE");
return r; return r;
}, },
'TODAY' : function(){ 'TODAY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TODAY");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(0); r.setArgumentsMax(0);
r.setName("TODAY");
r.Calculate = function(){ r.Calculate = function(){
var d = new Date(); var d = new Date();
// 1 2 3 3 4 5 5 4 2 1 // 1 2 3 3 4 5 5 4 2 1
...@@ -2296,18 +2260,15 @@ var cFormulaFunction = { ...@@ -2296,18 +2260,15 @@ var cFormulaFunction = {
//Math.floor(((new Date()).getTime()/1000)/c_sPerDay+(c_DateCorrectConst+1)) from UTC-timestamp to excel 2010 //Math.floor(((new Date()).getTime()/1000)/c_sPerDay+(c_DateCorrectConst+1)) from UTC-timestamp to excel 2010
}, },
'WEEKDAY' : function(){ 'WEEKDAY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("WEEKDAY");
r.setName("WEEKDAY");
return r; return r;
}, },
'WEEKNUM' : function(){ 'WEEKNUM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("WEEKNUM");
r.setName("WEEKNUM");
return r; return r;
}, },
'WORKDAY' : function(){ 'WORKDAY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("WORKDAY");
r.setName("WORKDAY");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -2420,15 +2381,13 @@ var cFormulaFunction = { ...@@ -2420,15 +2381,13 @@ var cFormulaFunction = {
return r; return r;
}, },
'WORKDAY.INTL' : function(){ 'WORKDAY.INTL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("WORKDAY.INTL");
r.setName("WORKDAY.INTL");
return r; return r;
}, },
'YEAR' : function(){ 'YEAR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("YEAR");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.setName("YEAR");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],val; var arg0 = arg[0],val;
if( arg0 instanceof cArray ){ if( arg0 instanceof cArray ){
...@@ -2484,309 +2443,249 @@ var cFormulaFunction = { ...@@ -2484,309 +2443,249 @@ var cFormulaFunction = {
return r; return r;
}, },
'YEARFRAC' : function(){ 'YEARFRAC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("YEARFRAC");
r.setName("YEARFRAC");
return r; return r;
} }
}, },
Engineering : { Engineering : {
'groupName' : "Engineering", 'groupName' : "Engineering",
'BESSELI' : function(){ 'BESSELI' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BESSELI");
r.setName("BESSELI");
return r; return r;
}, },
'BESSELJ' : function(){ 'BESSELJ' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BESSELJ");
r.setName("BESSELJ");
return r; return r;
}, },
'BESSELK' : function(){ 'BESSELK' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BESSELK");
r.setName("BESSELK");
return r; return r;
}, },
'BESSELY' : function(){ 'BESSELY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BESSELY");
r.setName("BESSELY");
return r; return r;
}, },
'BIN2DEC' : function(){ 'BIN2DEC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BIN2DEC");
r.setName("BIN2DEC");
return r; return r;
}, },
'BIN2HEX' : function(){ 'BIN2HEX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BIN2HEX");
r.setName("BIN2HEX");
return r; return r;
}, },
'BIN2OCT' : function(){ 'BIN2OCT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BIN2OCT");
r.setName("BIN2OCT");
return r; return r;
}, },
'COMPLEX' : function(){ 'COMPLEX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COMPLEX");
r.setName("COMPLEX");
return r; return r;
}, },
'CONVERT' : function(){ 'CONVERT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CONVERT");
r.setName("CONVERT");
return r; return r;
}, },
'DEC2BIN' : function(){ 'DEC2BIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DEC2BIN");
r.setName("DEC2BIN");
return r; return r;
}, },
'DEC2HEX' : function(){ 'DEC2HEX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DEC2HEX");
r.setName("DEC2HEX");
return r; return r;
}, },
'DEC2OCT' : function(){ 'DEC2OCT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DEC2OCT");
r.setName("DEC2OCT");
return r; return r;
}, },
'DELTA' : function(){ 'DELTA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DELTA");
r.setName("DELTA");
return r; return r;
}, },
'ERF' : function(){ 'ERF' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ERF");
r.setName("ERF");
return r; return r;
}, },
'ERFC' : function(){ 'ERFC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ERFC");
r.setName("ERFC");
return r; return r;
}, },
'GESTEP' : function(){ 'GESTEP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GESTEP");
r.setName("GESTEP");
return r; return r;
}, },
'HEX2BIN' : function(){ 'HEX2BIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HEX2BIN");
r.setName("HEX2BIN");
return r; return r;
}, },
'HEX2DEC' : function(){ 'HEX2DEC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HEX2DEC");
r.setName("HEX2DEC");
return r; return r;
}, },
'HEX2OCT' : function(){ 'HEX2OCT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HEX2OCT");
r.setName("HEX2OCT");
return r; return r;
}, },
'IMABS' : function(){ 'IMABS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMABS");
r.setName("IMABS");
return r; return r;
}, },
'IMAGINARY' : function(){ 'IMAGINARY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMAGINARY");
r.setName("IMAGINARY");
return r; return r;
}, },
'IMARGUMENT' : function(){ 'IMARGUMENT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMARGUMENT");
r.setName("IMARGUMENT");
return r; return r;
}, },
'IMCONJUGATE' : function(){ 'IMCONJUGATE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMCONJUGATE");
r.setName("IMCONJUGATE");
return r; return r;
}, },
'IMCOS' : function(){ 'IMCOS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMCOS");
r.setName("IMCOS");
return r; return r;
}, },
'IMDIV' : function(){ 'IMDIV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMDIV");
r.setName("IMDIV");
return r; return r;
}, },
'IMEXP' : function(){ 'IMEXP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMEXP");
r.setName("IMEXP");
return r; return r;
}, },
'IMLN' : function(){ 'IMLN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMLN");
r.setName("IMLN");
return r; return r;
}, },
'IMLOG10' : function(){ 'IMLOG10' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMLOG10");
r.setName("IMLOG10");
return r; return r;
}, },
'IMLOG2' : function(){ 'IMLOG2' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMLOG2");
r.setName("IMLOG2");
return r; return r;
}, },
'IMPOWER' : function(){ 'IMPOWER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMPOWER");
r.setName("IMPOWER");
return r; return r;
}, },
'IMPRODUCT' : function(){ 'IMPRODUCT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMPRODUCT");
r.setName("IMPRODUCT");
return r; return r;
}, },
'IMREAL' : function(){ 'IMREAL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMREAL");
r.setName("IMREAL");
return r; return r;
}, },
'IMSIN' : function(){ 'IMSIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMSIN");
r.setName("IMSIN");
return r; return r;
}, },
'IMSQRT' : function(){ 'IMSQRT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMSQRT");
r.setName("IMSQRT");
return r; return r;
}, },
'IMSUB' : function(){ 'IMSUB' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMSUB");
r.setName("IMSUB");
return r; return r;
}, },
'IMSUM' : function(){ 'IMSUM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IMSUM");
r.setName("IMSUM");
return r; return r;
}, },
'OCT2BIN' : function(){ 'OCT2BIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("OCT2BIN");
r.setName("OCT2BIN");
return r; return r;
}, },
'OCT2DEC' : function(){ 'OCT2DEC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("OCT2DEC");
r.setName("OCT2DEC");
return r; return r;
}, },
'OCT2HEX' : function(){ 'OCT2HEX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("OCT2HEX");
r.setName("OCT2HEX");
return r; return r;
} }
}, },
Financial : { Financial : {
'groupName' : "Financial", 'groupName' : "Financial",
'ACCRINT' : function(){ 'ACCRINT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ACCRINT");
r.setName("ACCRINT");
return r; return r;
}, },
'ACCRINTM' : function(){ 'ACCRINTM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ACCRINTM");
r.setName("ACCRINTM");
return r; return r;
}, },
'AMORDEGRC' : function(){ 'AMORDEGRC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AMORDEGRC");
r.setName("AMORDEGRC");
return r; return r;
}, },
'AMORLINC' : function(){ 'AMORLINC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AMORLINC");
r.setName("AMORLINC");
return r; return r;
}, },
'COUPDAYBS' : function(){ 'COUPDAYBS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUPDAYBS");
r.setName("COUPDAYBS");
return r; return r;
}, },
'COUPDAYS' : function(){ 'COUPDAYS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUPDAYS");
r.setName("COUPDAYS");
return r; return r;
}, },
'COUPDAYSNC' : function(){ 'COUPDAYSNC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUPDAYSNC");
r.setName("COUPDAYSNC");
return r; return r;
}, },
'COUPNCD' : function(){ 'COUPNCD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUPNCD");
r.setName("COUPNCD");
return r; return r;
}, },
'COUPNUM' : function(){ 'COUPNUM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUPNUM");
r.setName("COUPNUM");
return r; return r;
}, },
'COUPPCD' : function(){ 'COUPPCD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUPPCD");
r.setName("COUPPCD");
return r; return r;
}, },
'CUMIPMT' : function(){ 'CUMIPMT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUMIPMT");
r.setName("CUMIPMT");
return r; return r;
}, },
'CUMPRINC' : function(){ 'CUMPRINC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CUMPRINC");
r.setName("CUMPRINC");
return r; return r;
}, },
'DB' : function(){ 'DB' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DB");
r.setName("DB");
return r; return r;
}, },
'DDB' : function(){ 'DDB' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DDB");
r.setName("DDB");
return r; return r;
}, },
'DISC' : function(){ 'DISC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DISC");
r.setName("DISC");
return r; return r;
}, },
'DOLLARDE' : function(){ 'DOLLARDE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DOLLARDE");
r.setName("DOLLARDE");
return r; return r;
}, },
'DOLLARFR' : function(){ 'DOLLARFR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DOLLARFR");
r.setName("DOLLARFR");
return r; return r;
}, },
'DURATION' : function(){ 'DURATION' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DURATION");
r.setName("DURATION");
return r; return r;
}, },
'EFFECT' : function(){ 'EFFECT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("EFFECT");
r.setName("EFFECT");
return r; return r;
}, },
'FV' : function(){ 'FV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FV");
r.setName("FV");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(5); r.setArgumentsMax(5);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -2861,53 +2760,43 @@ var cFormulaFunction = { ...@@ -2861,53 +2760,43 @@ var cFormulaFunction = {
return r; return r;
}, },
'FVSCHEDULE' : function(){ 'FVSCHEDULE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FVSCHEDULE");
r.setName("FVSCHEDULE");
return r; return r;
}, },
'INTRATE' : function(){ 'INTRATE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("INTRATE");
r.setName("INTRATE");
return r; return r;
}, },
'IPMT' : function(){ 'IPMT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IPMT");
r.setName("IPMT");
return r; return r;
}, },
'IRR' : function(){ 'IRR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IRR");
r.setName("IRR");
return r; return r;
}, },
'ISPMT' : function(){ 'ISPMT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISPMT");
r.setName("ISPMT");
return r; return r;
}, },
'MDURATION' : function(){ 'MDURATION' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MDURATION");
r.setName("MDURATION");
return r; return r;
}, },
'MIRR' : function(){ 'MIRR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MIRR");
r.setName("MIRR");
return r; return r;
}, },
'NOMINAL' : function(){ 'NOMINAL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NOMINAL");
r.setName("NOMINAL");
return r; return r;
}, },
'NPER' : function(){ 'NPER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NPER");
r.setName("NPER");
return r; return r;
}, },
'NPV' : function(){ 'NPV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NPV");
r.setName("NPV");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -2977,53 +2866,118 @@ var cFormulaFunction = { ...@@ -2977,53 +2866,118 @@ var cFormulaFunction = {
return r; return r;
}, },
'ODDFPRICE' : function(){ 'ODDFPRICE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ODDFPRICE");
r.setName("ODDFPRICE");
return r; return r;
}, },
'ODDFYIELD' : function(){ 'ODDFYIELD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ODDFYIELD");
r.setName("ODDFYIELD");
return r; return r;
}, },
'ODDLPRICE' : function(){ 'ODDLPRICE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ODDLPRICE");
r.setName("ODDLPRICE");
return r; return r;
}, },
'ODDLYIELD' : function(){ 'ODDLYIELD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ODDLYIELD");
r.setName("ODDLYIELD");
return r; return r;
}, },
'PMT' : function(){ 'PMT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PMT");
r.setName("PMT"); r.setArgumentsMin(3);
r.setArgumentsMax(5);
r.Calculate = function(arg){
var rate = arg[0], nper = arg[1], pv = arg[2], fv = arg[3] ? arg[3] : new cNumber(0), type = arg[4] ? arg[4] : new cNumber(0);
if ( rate instanceof cArea || rate instanceof cArea3D ){
rate = rate.cross(arguments[1].first);
}
else if( rate instanceof cArray ){
rate = rate.getElementRowCol(0,0);
}
if ( nper instanceof cArea || nper instanceof cArea3D ){
nper = nper.cross(arguments[1].first);
}
else if( nper instanceof cArray ){
nper = nper.getElementRowCol(0,0);
}
if ( pv instanceof cArea || pv instanceof cArea3D ){
pv = pv.cross(arguments[1].first);
}
else if( pv instanceof cArray ){
pv = pv.getElementRowCol(0,0);
}
if ( fv instanceof cArea || fv instanceof cArea3D ){
fv = fv.cross(arguments[1].first);
}
else if( fv instanceof cArray ){
fv = fv.getElementRowCol(0,0);
}
if ( type instanceof cArea || type instanceof cArea3D ){
type = type.cross(arguments[1].first);
}
else if( type instanceof cArray ){
type = type.getElementRowCol(0,0);
}
rate = rate.tocNumber();
nper = nper.tocNumber();
pv = pv.tocNumber();
fv = fv.tocNumber();
type = type.tocNumber();
if ( rate instanceof cError ) return this.value = rate;
if ( nper instanceof cError ) return this.value = nper;
if ( nper.getValue() == 0 ) return this.value = new cError( cErrorType.division_by_zero );
if ( pv instanceof cError ) return this.value = pv;
if ( fv instanceof cError ) return this.value = fv;
if ( type instanceof cError ) return this.value = type;
if ( type.getValue() != 1 && type.getValue() != 0 ) return this.value = new cError( cErrorType.not_numeric );
var res;
if( rate.getValue() != 0 ){
res = -1*( pv.getValue() * Math.pow( 1 + rate.getValue(), nper.getValue() ) + fv.getValue() ) /
( ( 1 + rate.getValue() * type.getValue() ) * ( Math.pow((1 + rate.getValue()), nper.getValue() ) - 1 ) / rate.getValue() );
}
else{
res = -1*( pv.getValue()+fv.getValue() )/ nper.getValue();
}
return this.value = new cNumber(res);
}
r.getInfo = function(){
return {
name:this.name,
args:"( rate , nper , pv [ , [ fv ] [ ,[ type ] ] ] )"
};
}
r.setFormat(r.formatType.noneFormat);
return r; return r;
}, },
'PPMT' : function(){ 'PPMT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PPMT");
r.setName("PPMT");
return r; return r;
}, },
'PRICE' : function(){ 'PRICE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PRICE");
r.setName("PRICE");
return r; return r;
}, },
'PRICEDISC' : function(){ 'PRICEDISC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PRICEDISC");
r.setName("PRICEDISC");
return r; return r;
}, },
'PRICEMAT' : function(){ 'PRICEMAT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PRICEMAT");
r.setName("PRICEMAT");
return r; return r;
}, },
'PV' : function(){ 'PV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PV");
r.setName("PV");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(5); r.setArgumentsMax(5);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3098,81 +3052,66 @@ var cFormulaFunction = { ...@@ -3098,81 +3052,66 @@ var cFormulaFunction = {
return r; return r;
}, },
'RATE' : function(){ 'RATE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RATE");
r.setName("RATE");
return r; return r;
}, },
'RECEIVED' : function(){ 'RECEIVED' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RECEIVED");
r.setName("RECEIVED");
return r; return r;
}, },
'SLN' : function(){ 'SLN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SLN");
r.setName("SLN");
return r; return r;
}, },
'SYD' : function(){ 'SYD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SYD");
r.setName("SYD");
return r; return r;
}, },
'TBILLEQ' : function(){ 'TBILLEQ' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TBILLEQ");
r.setName("TBILLEQ");
return r; return r;
}, },
'TBILLPRICE' : function(){ 'TBILLPRICE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TBILLPRICE");
r.setName("TBILLPRICE");
return r; return r;
}, },
'TBILLYIELD' : function(){ 'TBILLYIELD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TBILLYIELD");
r.setName("TBILLYIELD");
return r; return r;
}, },
'VDB' : function(){ 'VDB' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("VDB");
r.setName("VDB");
return r; return r;
}, },
'XIRR' : function(){ 'XIRR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("XIRR");
r.setName("XIRR");
return r; return r;
}, },
'XNPV' : function(){ 'XNPV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("XNPV");
r.setName("XNPV");
return r; return r;
}, },
'YIELD' : function(){ 'YIELD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("YIELD");
r.setName("YIELD");
return r; return r;
}, },
'YIELDDISC' : function(){ 'YIELDDISC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("YIELDDISC");
r.setName("YIELDDISC");
return r; return r;
}, },
'YIELDMAT' : function(){ 'YIELDMAT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("YIELDMAT");
r.setName("YIELDMAT");
return r; return r;
} }
}, },
Information : { Information : {
'groupName' : "Information", 'groupName' : "Information",
"CELL" :function(){ "CELL" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CELL");
r.setName("CELL");
return r; return r;
}, },
"ERROR.TYPE" :function(){ "ERROR.TYPE" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ERROR.TYPE");
r.setName("ERROR.TYPE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3229,13 +3168,11 @@ var cFormulaFunction = { ...@@ -3229,13 +3168,11 @@ var cFormulaFunction = {
return r; return r;
}, },
"INFO" :function(){ "INFO" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("INFO");
r.setName("INFO");
return r; return r;
}, },
"ISBLANK" :function(){ "ISBLANK" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISBLANK");
r.setName("ISBLANK");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3260,8 +3197,7 @@ var cFormulaFunction = { ...@@ -3260,8 +3197,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISERR" :function(){ "ISERR" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISERR");
r.setName("ISERR");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3289,8 +3225,7 @@ var cFormulaFunction = { ...@@ -3289,8 +3225,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISERROR" :function(){ "ISERROR" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISERROR");
r.setName("ISERROR");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3318,8 +3253,7 @@ var cFormulaFunction = { ...@@ -3318,8 +3253,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISEVEN" :function(){ "ISEVEN" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISEVEN");
r.setName("ISEVEN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3350,8 +3284,7 @@ var cFormulaFunction = { ...@@ -3350,8 +3284,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISLOGICAL" :function(){ "ISLOGICAL" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISLOGICAL");
r.setName("ISLOGICAL");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3378,8 +3311,7 @@ var cFormulaFunction = { ...@@ -3378,8 +3311,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISNA" :function(){ "ISNA" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISNA");
r.setName("ISNA");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3407,8 +3339,7 @@ var cFormulaFunction = { ...@@ -3407,8 +3339,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISNONTEXT" :function(){ "ISNONTEXT" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISNONTEXT");
r.setName("ISNONTEXT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3436,8 +3367,7 @@ var cFormulaFunction = { ...@@ -3436,8 +3367,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISNUMBER" :function(){ "ISNUMBER" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISNUMBER");
r.setName("ISNUMBER");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3465,8 +3395,7 @@ var cFormulaFunction = { ...@@ -3465,8 +3395,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISODD" :function(){ "ISODD" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISODD");
r.setName("ISODD");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3497,8 +3426,7 @@ var cFormulaFunction = { ...@@ -3497,8 +3426,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISREF" :function(){ "ISREF" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISREF");
r.setName("ISREF");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3515,8 +3443,7 @@ var cFormulaFunction = { ...@@ -3515,8 +3443,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"ISTEXT" :function(){ "ISTEXT" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISTEXT");
r.setName("ISTEXT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3544,8 +3471,7 @@ var cFormulaFunction = { ...@@ -3544,8 +3471,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"N" :function(){ "N" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("N");
r.setName("N");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3586,8 +3512,7 @@ var cFormulaFunction = { ...@@ -3586,8 +3512,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"NA" :function(){ "NA" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NA");
r.setName("NA");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(0); r.setArgumentsMax(0);
r.Calculate = function(){ r.Calculate = function(){
...@@ -3602,8 +3527,7 @@ var cFormulaFunction = { ...@@ -3602,8 +3527,7 @@ var cFormulaFunction = {
return r; return r;
}, },
"TYPE" :function(){ "TYPE" :function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TYPE");
r.setName("TYPE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3637,8 +3561,7 @@ var cFormulaFunction = { ...@@ -3637,8 +3561,7 @@ var cFormulaFunction = {
Logical : { Logical : {
'groupName' : "Logical", 'groupName' : "Logical",
'AND' : function(){ 'AND' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AND");
r.setName("AND");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3702,8 +3625,7 @@ var cFormulaFunction = { ...@@ -3702,8 +3625,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'FALSE' : function(){ 'FALSE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FALSE");
r.setName("FALSE");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(0); r.setArgumentsMax(0);
r.Calculate = function(){ r.Calculate = function(){
...@@ -3718,8 +3640,7 @@ var cFormulaFunction = { ...@@ -3718,8 +3640,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'IF' : function(){ 'IF' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IF");
r.setName("IF");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3761,8 +3682,7 @@ var cFormulaFunction = { ...@@ -3761,8 +3682,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'IFERROR' : function(){ 'IFERROR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("IFERROR");
r.setName("IFERROR");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3790,8 +3710,7 @@ var cFormulaFunction = { ...@@ -3790,8 +3710,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'NOT' : function(){ 'NOT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NOT");
r.setName("NOT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3824,8 +3743,7 @@ var cFormulaFunction = { ...@@ -3824,8 +3743,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'OR' : function(){ 'OR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("OR");
r.setName("OR");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3886,8 +3804,7 @@ var cFormulaFunction = { ...@@ -3886,8 +3804,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'TRUE' : function(){ 'TRUE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TRUE");
r.setName("TRUE");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(0); r.setArgumentsMax(0);
r.Calculate = function(){ r.Calculate = function(){
...@@ -3905,18 +3822,15 @@ var cFormulaFunction = { ...@@ -3905,18 +3822,15 @@ var cFormulaFunction = {
LookupAndReference : { LookupAndReference : {
'groupName' : "LookupAndReference", 'groupName' : "LookupAndReference",
'ADDRESS' : function(){ 'ADDRESS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ADDRESS");
r.setName("ADDRESS");
return r; return r;
}, },
'AREAS' : function(){ 'AREAS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AREAS");
r.setName("AREAS");
return r; return r;
}, },
'CHOOSE' : function(){ 'CHOOSE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CHOOSE");
r.setName("CHOOSE");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(30); r.setArgumentsMax(30);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3950,8 +3864,7 @@ var cFormulaFunction = { ...@@ -3950,8 +3864,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'COLUMN' : function(){ 'COLUMN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COLUMN");
r.setName("COLUMN");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -3989,18 +3902,42 @@ var cFormulaFunction = { ...@@ -3989,18 +3902,42 @@ var cFormulaFunction = {
return r; return r;
}, },
'COLUMNS' : function(){ 'COLUMNS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COLUMNS");
r.setName("COLUMNS"); r.setArgumentsMin(1);
r.setArgumentsMax(1);
r.Calculate = function(arg){
var arg0 = arg[0];
if( arg0 instanceof cArray ){
return this.value = new cNumber(arg0.getCountElementInRow());
}
else if( arg0 instanceof cArea || arg0 instanceof cRef || arg0 instanceof cRef3D ){
var range = arg0.getRange();
return this.value = new cNumber( Math.abs( range.getBBox().c1 - range.getBBox().c2 ) + 1 );
}
else if( arg0 instanceof cArea3D ){
var range = arg0.getRange();
if( range.length > 1 )
return this.value = new cError( cErrorType.wrong_value_type );
return this.value = new cNumber( Math.abs(range[0].getBBox().c1 - range[0].getBBox().c2) + 1 );
}
else
return this.value = new cError( cErrorType.wrong_value_type );
}
r.getInfo = function(){
return {
name:this.name,
args:"( array )"
};
}
return r; return r;
}, },
'GETPIVOTDATA' : function(){ 'GETPIVOTDATA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GETPIVOTDATA");
r.setName("GETPIVOTDATA");
return r; return r;
}, },
'HLOOKUP' : function(){ 'HLOOKUP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HLOOKUP");
r.setName("HLOOKUP");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(4); r.setArgumentsMax(4);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4146,18 +4083,15 @@ var cFormulaFunction = { ...@@ -4146,18 +4083,15 @@ var cFormulaFunction = {
return r; return r;
}, },
'HYPERLINK' : function(){ 'HYPERLINK' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HYPERLINK");
r.setName("HYPERLINK");
return r; return r;
}, },
'INDEX' : function(){ 'INDEX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("INDEX");
r.setName("INDEX");
return r; return r;
}, },
'INDIRECT' : function(){ 'INDIRECT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("INDIRECT");
r.setName("INDIRECT");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4232,8 +4166,7 @@ var cFormulaFunction = { ...@@ -4232,8 +4166,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'LOOKUP' : function(){ 'LOOKUP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LOOKUP");
r.setName("LOOKUP");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4349,18 +4282,15 @@ var cFormulaFunction = { ...@@ -4349,18 +4282,15 @@ var cFormulaFunction = {
return r; return r;
}, },
'MATCH' : function(){ 'MATCH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MATCH");
r.setName("MATCH");
return r; return r;
}, },
'OFFSET' : function(){ 'OFFSET' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("OFFSET");
r.setName("OFFSET");
return r; return r;
}, },
'ROW' : function(){ 'ROW' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ROW");
r.setName("ROW");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4398,23 +4328,46 @@ var cFormulaFunction = { ...@@ -4398,23 +4328,46 @@ var cFormulaFunction = {
return r; return r;
}, },
'ROWS' : function(){ 'ROWS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ROWS");
r.setName("ROWS"); r.setArgumentsMin(1);
r.setArgumentsMax(1);
r.Calculate = function(arg){
var arg0 = arg[0];
if( arg0 instanceof cArray ){
return this.value = new cNumber(arg0.getRowCount());
}
else if( arg0 instanceof cArea || arg0 instanceof cRef || arg0 instanceof cRef3D ){
var range = arg0.getRange();
return this.value = new cNumber( Math.abs( range.getBBox().r1 - range.getBBox().r2 ) + 1 );
}
else if( arg0 instanceof cArea3D ){
var range = arg0.getRange();
if( range.length > 1 )
return this.value = new cError( cErrorType.wrong_value_type );
return this.value = new cNumber( Math.abs(range[0].getBBox().r1 - range[0].getBBox().r2) + 1 );
}
else
return this.value = new cError( cErrorType.wrong_value_type );
}
r.getInfo = function(){
return {
name:this.name,
args:"( array )"
};
}
return r; return r;
}, },
'RTD' : function(){ 'RTD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RTD");
r.setName("RTD");
return r; return r;
}, },
'TRANSPOSE' : function(){ 'TRANSPOSE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TRANSPOSE");
r.setName("TRANSPOSE");
return r; return r;
}, },
'VLOOKUP' : function(){ 'VLOOKUP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("VLOOKUP");
r.setName("VLOOKUP");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(4); r.setArgumentsMax(4);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4563,8 +4516,7 @@ var cFormulaFunction = { ...@@ -4563,8 +4516,7 @@ var cFormulaFunction = {
Mathematic : { Mathematic : {
'groupName' : "Mathematic", 'groupName' : "Mathematic",
'ABS' : function(){ 'ABS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ABS");
r.setName("ABS");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4599,8 +4551,7 @@ var cFormulaFunction = { ...@@ -4599,8 +4551,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'ACOS' : function(){ 'ACOS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ACOS");
r.setName("ACOS");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4637,13 +4588,11 @@ var cFormulaFunction = { ...@@ -4637,13 +4588,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'ACOSH' : function(){ 'ACOSH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ACOSH");
r.setName("ACOSH");
return r; return r;
}, },
'ASIN' : function(){ 'ASIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ASIN");
r.setName("ASIN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4680,13 +4629,11 @@ var cFormulaFunction = { ...@@ -4680,13 +4629,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'ASINH' : function(){ 'ASINH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ASINH");
r.setName("ASINH");
return r; return r;
}, },
'ATAN' : function(){ 'ATAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ATAN");
r.setName("ATAN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4724,10 +4671,9 @@ var cFormulaFunction = { ...@@ -4724,10 +4671,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'ATAN2' : function(){ 'ATAN2' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ATAN2");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.setName("ATAN2");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],arg1 = arg[1]; var arg0 = arg[0],arg1 = arg[1];
if( arg0 instanceof cArea || arg0 instanceof cArea3D ){ if( arg0 instanceof cArea || arg0 instanceof cArea3D ){
...@@ -4803,13 +4749,11 @@ var cFormulaFunction = { ...@@ -4803,13 +4749,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'ATANH' : function(){ 'ATANH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ATANH");
r.setName("ATANH");
return r; return r;
}, },
'CEILING' : function(){ 'CEILING' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CEILING");
r.setName("CEILING");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4901,13 +4845,11 @@ var cFormulaFunction = { ...@@ -4901,13 +4845,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'COMBIN' : function(){ 'COMBIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COMBIN");
r.setName("COMBIN");
return r; return r;
}, },
'COS' : function (){ 'COS' : function (){
var r = new cBaseFunction(); var r = new cBaseFunction("COS");
r.setName("COS");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4944,13 +4886,11 @@ var cFormulaFunction = { ...@@ -4944,13 +4886,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'COSH' : function(){ 'COSH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COSH");
r.setName("COSH");
return r; return r;
}, },
'DEGREES' : function(){ 'DEGREES' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DEGREES");
r.setName("DEGREES");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -4988,13 +4928,11 @@ var cFormulaFunction = { ...@@ -4988,13 +4928,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'ECMA.CEILING' : function(){ 'ECMA.CEILING' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ECMA_CEILING");
r.setName("ECMA_CEILING");
return r; return r;
}, },
'EVEN' : function(){ 'EVEN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("EVEN");
r.setName("EVEN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5053,8 +4991,7 @@ var cFormulaFunction = { ...@@ -5053,8 +4991,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'EXP' : function(){ 'EXP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("EXP");
r.setName("EXP");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5094,18 +5031,15 @@ var cFormulaFunction = { ...@@ -5094,18 +5031,15 @@ var cFormulaFunction = {
return r; return r;
}, },
'FACT' : function(){ 'FACT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FACT");
r.setName("FACT");
return r; return r;
}, },
'FACTDOUBLE' : function(){ 'FACTDOUBLE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FACTDOUBLE");
r.setName("FACTDOUBLE");
return r; return r;
}, },
'FLOOR' : function(){ 'FLOOR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FLOOR");
r.setName("FLOOR");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5196,8 +5130,7 @@ var cFormulaFunction = { ...@@ -5196,8 +5130,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'GCD' : function(){ 'GCD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GCD");
r.setName("GCD");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5286,8 +5219,7 @@ var cFormulaFunction = { ...@@ -5286,8 +5219,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'INT' : function(){ 'INT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("INT");
r.setName("INT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5324,18 +5256,15 @@ var cFormulaFunction = { ...@@ -5324,18 +5256,15 @@ var cFormulaFunction = {
return r; return r;
}, },
'ISO.CEILING' : function(){ 'ISO.CEILING' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ISO_CEILING");
r.setName("ISO_CEILING");
return r; return r;
}, },
'LCM' : function(){ 'LCM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LCM");
r.setName("LCM");
return r; return r;
}, },
'LN' : function(){ 'LN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LN");
r.setName("LN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5377,8 +5306,7 @@ var cFormulaFunction = { ...@@ -5377,8 +5306,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'LOG' : function(){ 'LOG' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LOG");
r.setName("LOG");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5473,8 +5401,7 @@ var cFormulaFunction = { ...@@ -5473,8 +5401,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'LOG10' : function(){ 'LOG10' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LOG10");
r.setName("LOG10");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5516,25 +5443,21 @@ var cFormulaFunction = { ...@@ -5516,25 +5443,21 @@ var cFormulaFunction = {
return r; return r;
}, },
'MDETERM' : function(){ 'MDETERM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MDETERM");
r.setName("MDETERM");
return r; return r;
}, },
'MINVERSE' : function(){ 'MINVERSE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MINVERSE");
r.setName("MINVERSE");
return r; return r;
}, },
'MMULT' : function(){ 'MMULT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MMULT");
r.setName("MMULT");
return r; return r;
}, },
'MOD' : function(){ 'MOD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MOD");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.setName("MOD");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = arg[0],arg1 = arg[1]; var arg0 = arg[0],arg1 = arg[1];
if( arg0 instanceof cArea || arg0 instanceof cArea3D ){ if( arg0 instanceof cArea || arg0 instanceof cArea3D ){
...@@ -5609,8 +5532,7 @@ var cFormulaFunction = { ...@@ -5609,8 +5532,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'MROUND' : function(){ 'MROUND' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MROUND");
r.setName("MROUND");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5703,13 +5625,11 @@ var cFormulaFunction = { ...@@ -5703,13 +5625,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'MULTINOMIAL' : function(){ 'MULTINOMIAL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MULTINOMIAL");
r.setName("MULTINOMIAL");
return r; return r;
}, },
'ODD' : function(){ 'ODD' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ODD");
r.setName("ODD");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5767,8 +5687,7 @@ var cFormulaFunction = { ...@@ -5767,8 +5687,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'PI' : function(){ 'PI' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PI");
r.setName("PI");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(0); r.setArgumentsMax(0);
r.Calculate = function(){ r.Calculate = function(){
...@@ -5783,8 +5702,7 @@ var cFormulaFunction = { ...@@ -5783,8 +5702,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'POWER' : function(){ 'POWER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("POWER");
r.setName("POWER");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5857,10 +5775,9 @@ var cFormulaFunction = { ...@@ -5857,10 +5775,9 @@ var cFormulaFunction = {
return r; return r;
}, },
'PRODUCT' : function(){ 'PRODUCT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PRODUCT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.setName("PRODUCT");
r.Calculate = function(arg){ r.Calculate = function(arg){
var arg0 = new cNumber(1), _aVal = null; var arg0 = new cNumber(1), _aVal = null;
for(var i = 0; i < arg.length; i++){ for(var i = 0; i < arg.length; i++){
...@@ -5903,13 +5820,11 @@ var cFormulaFunction = { ...@@ -5903,13 +5820,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'QUOTIENT' : function(){ 'QUOTIENT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("QUOTIENT");
r.setName("QUOTIENT");
return r; return r;
}, },
'RADIANS' : function(){ 'RADIANS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RADIANS");
r.setName("RADIANS");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -5950,8 +5865,7 @@ var cFormulaFunction = { ...@@ -5950,8 +5865,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'RAND' : function(){ 'RAND' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RAND");
r.setName("RAND");
r.setArgumentsMin(0); r.setArgumentsMin(0);
r.setArgumentsMax(0); r.setArgumentsMax(0);
r.Calculate = function(){ r.Calculate = function(){
...@@ -5966,18 +5880,15 @@ var cFormulaFunction = { ...@@ -5966,18 +5880,15 @@ var cFormulaFunction = {
return r; return r;
}, },
'RANDBETWEEN' : function(){ 'RANDBETWEEN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RANDBETWEEN");
r.setName("RANDBETWEEN");
return r; return r;
}, },
'ROMAN' : function(){ 'ROMAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ROMAN");
r.setName("ROMAN");
return r; return r;
}, },
'ROUND' : function(){ 'ROUND' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ROUND");
r.setName("ROUND");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6111,8 +6022,7 @@ var cFormulaFunction = { ...@@ -6111,8 +6022,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'ROUNDDOWN' : function(){ 'ROUNDDOWN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ROUNDDOWN");
r.setName("ROUNDDOWN");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6222,8 +6132,7 @@ var cFormulaFunction = { ...@@ -6222,8 +6132,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'ROUNDUP' : function(){ 'ROUNDUP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ROUNDUP");
r.setName("ROUNDUP");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6333,13 +6242,11 @@ var cFormulaFunction = { ...@@ -6333,13 +6242,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'SERIESSUM' : function(){ 'SERIESSUM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SERIESSUM");
r.setName("SERIESSUM");
return r; return r;
}, },
'SIGN' : function(){ 'SIGN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SIGN");
r.setName("SIGN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6388,8 +6295,7 @@ var cFormulaFunction = { ...@@ -6388,8 +6295,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'SIN' : function(){ 'SIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SIN");
r.setName("SIN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6423,13 +6329,11 @@ var cFormulaFunction = { ...@@ -6423,13 +6329,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'SINH' : function(){ 'SINH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SINH");
r.setName("SINH");
return r; return r;
}, },
'SQRT' : function(){ 'SQRT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SQRT");
r.setName("SQRT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6466,8 +6370,7 @@ var cFormulaFunction = { ...@@ -6466,8 +6370,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'SQRTPI' : function(){ 'SQRTPI' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SQRTPI");
r.setName("SQRTPI");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6504,13 +6407,11 @@ var cFormulaFunction = { ...@@ -6504,13 +6407,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'SUBTOTAL' : function(){ 'SUBTOTAL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUBTOTAL");
r.setName("SUBTOTAL");
return r; return r;
}, },
'SUM' : function(){ 'SUM' : function(){
var r = new cBaseFunction(this); var r = new cBaseFunction("SUM");
r.setName("SUM");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6557,8 +6458,7 @@ var cFormulaFunction = { ...@@ -6557,8 +6458,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'SUMIF' : function(){ 'SUMIF' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUMIF");
r.setName("SUMIF");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6698,38 +6598,123 @@ var cFormulaFunction = { ...@@ -6698,38 +6598,123 @@ var cFormulaFunction = {
return r; return r;
}, },
'SUMIFS' : function(){ 'SUMIFS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUMIFS");
r.setName("SUMIFS");
return r; return r;
}, },
'SUMPRODUCT' : function(){ 'SUMPRODUCT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUMPRODUCT");
r.setName("SUMPRODUCT"); /*r.setArgumentsMin(1);
r.setArgumentsMax(255);
r.Calculate = function(arg){
var arg0 = new cNumber(0), resArr = [];
for(var i = 0; i < arg.length; i++){
if( arg[i] instanceof cArea3D )
return this.value = new cError( bad_reference );
if( arg[i] instanceof cArea ){
function retCell(_cell){
if(!_cell)
return new cNumber(0);
switch( _cell.getType() ){
case CellValueType.Number:
_cell.getValueWithoutFormat() == ""? return new cNumber(0) : return new cNumber( _cell.getValueWithoutFormat() );
case CellValueType.Bool:
return new cBool( _cell.getValueWithoutFormat() ).tocNumber();
case CellValueType.Error:
return new cError( _cell.getValueWithoutFormat() );
case CellValueType.String:
default:
return new cNumber(0);
}
}
var argIBBox = arg[i].getBBox0(),
colCount = Math.abs(argIBBox.c2-argIBBox.c1)+1,
rowCount = Math.abs(argIBBox.r2-argIBBox.r1)+1,
range = arg[i].getRange();
range._foreachIndex(function(i,j){
})
if( resArr.length == 0 ){
for( var i = 0; i < rowCount; i++ ){
resArr.push(new Array(colCount));
}
}
else{
if( resArr.length == rowCount ){
if( resArr[0] == colCount ){
}
else
return this.value = new cError( not_numeric );
}
else
return this.value = new cError( not_numeric );
}
arg[i].foreach(function(oCurCell, i, j, r, c){
if( resArr[i] !== undefined && resArr[i] !== null ){
if( resArr[i][j] !== undefined && resArr[i][j] !== null ){
}
else{
resArr[i][j] = retCell(oCurCell);
}
}
else{
resArr[i] = [];
resArr[i][j] = !oCurCell ? new cNumber(0) :
}
})
}
else if( arg[i] instanceof cRef || arg[i] instanceof cRef3D ){
}
else if( arg[i] instanceof cArray ){
}
else{
}
if( arg[i] instanceof cError )
return this.value = arg0;
}
return this.value = arg0;
}
r.getInfo = function(){
return {
name:this.name,
args:"( argument-lists )"
};
}*/
return r; return r;
}, },
'SUMSQ' : function(){ 'SUMSQ' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUMSQ");
r.setName("SUMSQ");
return r; return r;
}, },
'SUMX2MY2' : function(){ 'SUMX2MY2' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUMX2MY2");
r.setName("SUMX2MY2");
return r; return r;
}, },
'SUMX2PY2' : function(){ 'SUMX2PY2' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUMX2PY2");
r.setName("SUMX2PY2");
return r; return r;
}, },
'SUMXMY2' : function(){ 'SUMXMY2' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUMXMY2");
r.setName("SUMXMY2");
return r; return r;
}, },
'TAN' : function(){ 'TAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TAN");
r.setName("TAN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6766,26 +6751,22 @@ var cFormulaFunction = { ...@@ -6766,26 +6751,22 @@ var cFormulaFunction = {
return r; return r;
}, },
'TANH' : function(){ 'TANH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TANH");
r.setName("TANH");
return r; return r;
}, },
'TRUNC' : function(){ 'TRUNC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TRUNC");
r.setName("TRUNC");
return r; return r;
} }
}, },
Statistical:{ Statistical:{
'groupName' : "Statistical", 'groupName' : "Statistical",
'AVEDEV' : function(){ 'AVEDEV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AVEDEV");
r.setName("AVEDEV");
return r; return r;
}, },
'AVERAGE' : function(){ 'AVERAGE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AVERAGE");
r.setName("AVERAGE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6836,63 +6817,51 @@ var cFormulaFunction = { ...@@ -6836,63 +6817,51 @@ var cFormulaFunction = {
return r; return r;
}, },
'AVERAGEA' : function(){ 'AVERAGEA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AVERAGEA");
r.setName("AVERAGEA");
return r; return r;
}, },
'AVERAGEIF' : function(){ 'AVERAGEIF' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AVERAGEIF");
r.setName("AVERAGEIF");
return r; return r;
}, },
'AVERAGEIFS' : function(){ 'AVERAGEIFS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("AVERAGEIFS");
r.setName("AVERAGEIFS");
return r; return r;
}, },
'BETADIST' : function(){ 'BETADIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BETADIST");
r.setName("BETADIST");
return r; return r;
}, },
'BETAINV' : function(){ 'BETAINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BETAINV");
r.setName("BETAINV");
return r; return r;
}, },
'BINOMDIST' : function(){ 'BINOMDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BINOMDIST");
r.setName("BINOMDIST");
return r; return r;
}, },
'CHIDIST' : function(){ 'CHIDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CHIDIST");
r.setName("CHIDIST");
return r; return r;
}, },
'CHIINV' : function(){ 'CHIINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CHIINV");
r.setName("CHIINV");
return r; return r;
}, },
'CHITEST' : function(){ 'CHITEST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CHITEST");
r.setName("CHITEST");
return r; return r;
}, },
'CONFIDENCE' : function(){ 'CONFIDENCE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CONFIDENCE");
r.setName("CONFIDENCE");
return r; return r;
}, },
'CORREL' : function(){ 'CORREL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CORREL");
r.setName("CORREL");
return r; return r;
}, },
'COUNT' : function(){ 'COUNT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUNT");
r.setName("COUNT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6941,13 +6910,11 @@ var cFormulaFunction = { ...@@ -6941,13 +6910,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'COUNTA' : function(){ 'COUNTA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUNTA");
r.setName("COUNTA");
return r; return r;
}, },
'COUNTBLANK' : function(){ 'COUNTBLANK' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUNTBLANK");
r.setName("COUNTBLANK");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -6970,8 +6937,7 @@ var cFormulaFunction = { ...@@ -6970,8 +6937,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'COUNTIF' : function(){ 'COUNTIF' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUNTIF");
r.setName("COUNTIF");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7097,138 +7063,111 @@ var cFormulaFunction = { ...@@ -7097,138 +7063,111 @@ var cFormulaFunction = {
return r; return r;
}, },
'COUNTIFS' : function(){ 'COUNTIFS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COUNTIFS");
r.setName("COUNTIFS");
return r; return r;
}, },
'COVAR' : function(){ 'COVAR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("COVAR");
r.setName("COVAR");
return r; return r;
}, },
'CRITBINOM' : function(){ 'CRITBINOM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CRITBINOM");
r.setName("CRITBINOM");
return r; return r;
}, },
'DEVSQ' : function(){ 'DEVSQ' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DEVSQ");
r.setName("DEVSQ");
return r; return r;
}, },
'EXPONDIST' : function(){ 'EXPONDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("EXPONDIST");
r.setName("EXPONDIST");
return r; return r;
}, },
'FDIST' : function(){ 'FDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FDIST");
r.setName("FDIST");
return r; return r;
}, },
'FINV' : function(){ 'FINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FINV");
r.setName("FINV");
return r; return r;
}, },
'FISHER' : function(){ 'FISHER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FISHER");
r.setName("FISHER");
return r; return r;
}, },
'FISHERINV' : function(){ 'FISHERINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FISHERINV");
r.setName("FISHERINV");
return r; return r;
}, },
'FORECAST' : function(){ 'FORECAST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FORECAST");
r.setName("FORECAST");
return r; return r;
}, },
'FREQUENCY' : function(){ 'FREQUENCY' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FREQUENCY");
r.setName("FREQUENCY");
return r; return r;
}, },
'FTEST' : function(){ 'FTEST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FTEST");
r.setName("FTEST");
return r; return r;
}, },
'GAMMADIST' : function(){ 'GAMMADIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GAMMADIST");
r.setName("GAMMADIST");
return r; return r;
}, },
'GAMMAINV' : function(){ 'GAMMAINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GAMMAINV");
r.setName("GAMMAINV");
return r; return r;
}, },
'GAMMALN' : function(){ 'GAMMALN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GAMMALN");
r.setName("GAMMALN");
return r; return r;
}, },
'GEOMEAN' : function(){ 'GEOMEAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GEOMEAN");
r.setName("GEOMEAN");
return r; return r;
}, },
'GROWTH' : function(){ 'GROWTH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("GROWTH");
r.setName("GROWTH");
return r; return r;
}, },
'HARMEAN' : function(){ 'HARMEAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HARMEAN");
r.setName("HARMEAN");
return r; return r;
}, },
'HYPGEOMDIST' : function(){ 'HYPGEOMDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("HYPGEOMDIST");
r.setName("HYPGEOMDIST");
return r; return r;
}, },
'INTERCEPT' : function(){ 'INTERCEPT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("INTERCEPT");
r.setName("INTERCEPT");
return r; return r;
}, },
'KURT' : function(){ 'KURT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("KURT");
r.setName("KURT");
return r; return r;
}, },
'LARGE' : function(){ 'LARGE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LARGE");
r.setName("LARGE");
return r; return r;
}, },
'LINEST' : function(){ 'LINEST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LINEST");
r.setName("LINEST");
return r; return r;
}, },
'LOGEST' : function(){ 'LOGEST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LOGEST");
r.setName("LOGEST");
return r; return r;
}, },
'LOGINV' : function(){ 'LOGINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LOGINV");
r.setName("LOGINV");
return r; return r;
}, },
'LOGNORMDIST' : function(){ 'LOGNORMDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LOGNORMDIST");
r.setName("LOGNORMDIST");
return r; return r;
}, },
'MAX' : function(){ 'MAX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MAX");
r.setName("MAX");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7301,8 +7240,7 @@ var cFormulaFunction = { ...@@ -7301,8 +7240,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'MAXA' : function(){ 'MAXA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MAXA");
r.setName("MAXA");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7377,13 +7315,11 @@ var cFormulaFunction = { ...@@ -7377,13 +7315,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'MEDIAN' : function(){ 'MEDIAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MEDIAN");
r.setName("MEDIAN");
return r; return r;
}, },
'MIN' : function(){ 'MIN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MIN");
r.setName("MIN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7457,8 +7393,7 @@ var cFormulaFunction = { ...@@ -7457,8 +7393,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'MINA' : function(){ 'MINA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MINA");
r.setName("MINA");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7535,103 +7470,83 @@ var cFormulaFunction = { ...@@ -7535,103 +7470,83 @@ var cFormulaFunction = {
return r; return r;
}, },
'MODE' : function(){ 'MODE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MODE");
r.setName("MODE");
return r; return r;
}, },
'NEGBINOMDIST' : function(){ 'NEGBINOMDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NEGBINOMDIST");
r.setName("NEGBINOMDIST");
return r; return r;
}, },
'NORMDIST' : function(){ 'NORMDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NORMDIST");
r.setName("NORMDIST");
return r; return r;
}, },
'NORMINV' : function(){ 'NORMINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunctionNORMINV
r.setName("NORMINV");
return r; return r;
}, },
'NORMSDIST' : function(){ 'NORMSDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NORMSDIST");
r.setName("NORMSDIST");
return r; return r;
}, },
'NORMSINV' : function(){ 'NORMSINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("NORMSINV");
r.setName("NORMSINV");
return r; return r;
}, },
'PEARSON' : function(){ 'PEARSON' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PEARSON");
r.setName("PEARSON");
return r; return r;
}, },
'PERCENTILE' : function(){ 'PERCENTILE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PERCENTILE");
r.setName("PERCENTILE");
return r; return r;
}, },
'PERCENTRANK' : function(){ 'PERCENTRANK' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PERCENTRANK");
r.setName("PERCENTRANK");
return r; return r;
}, },
'PERMUT' : function(){ 'PERMUT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PERMUT");
r.setName("PERMUT");
return r; return r;
}, },
'POISSON' : function(){ 'POISSON' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("POISSON");
r.setName("POISSON");
return r; return r;
}, },
'PROB' : function(){ 'PROB' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PROB");
r.setName("PROB");
return r; return r;
}, },
'QUARTILE' : function(){ 'QUARTILE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("QUARTILE");
r.setName("QUARTILE");
return r; return r;
}, },
'RANK' : function(){ 'RANK' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RANK");
r.setName("RANK");
return r; return r;
}, },
'RSQ' : function(){ 'RSQ' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RSQ");
r.setName("RSQ");
return r; return r;
}, },
'SKEW' : function(){ 'SKEW' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SKEW");
r.setName("SKEW");
return r; return r;
}, },
'SLOPE' : function(){ 'SLOPE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SLOPE");
r.setName("SLOPE");
return r; return r;
}, },
'SMALL' : function(){ 'SMALL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SMALL");
r.setName("SMALL");
return r; return r;
}, },
'STANDARDIZE' : function(){ 'STANDARDIZE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("STANDARDIZE");
r.setName("STANDARDIZE");
return r; return r;
}, },
'STDEV' : function(){ 'STDEV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("STDEV");
r.setName("STDEV");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7693,96 +7608,78 @@ var cFormulaFunction = { ...@@ -7693,96 +7608,78 @@ var cFormulaFunction = {
return r; return r;
}, },
'STDEVA' : function(){ 'STDEVA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("STDEVA");
r.setName("STDEVA");
return r; return r;
}, },
'STDEVP' : function(){ 'STDEVP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("STDEVP");
r.setName("STDEVP");
return r; return r;
}, },
'STDEVPA' : function(){ 'STDEVPA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("STDEVPA");
r.setName("STDEVPA");
return r; return r;
}, },
'STEYX' : function(){ 'STEYX' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("STEYX");
r.setName("STEYX");
return r; return r;
}, },
'TDIST' : function(){ 'TDIST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TDIST");
r.setName("TDIST");
return r; return r;
}, },
'TINV' : function(){ 'TINV' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TINV");
r.setName("TINV");
return r; return r;
}, },
'TREND' : function(){ 'TREND' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TREND");
r.setName("TREND");
return r; return r;
}, },
'TRIMMEAN' : function(){ 'TRIMMEAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TRIMMEAN");
r.setName("TRIMMEAN");
return r; return r;
}, },
'TTEST' : function(){ 'TTEST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TTEST");
r.setName("TTEST");
return r; return r;
}, },
'VAR' : function(){ 'VAR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("VAR");
r.setName("VAR");
return r; return r;
}, },
'VARA' : function(){ 'VARA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("VARA");
r.setName("VARA");
return r; return r;
}, },
'VARP' : function(){ 'VARP' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("VARP");
r.setName("VARP");
return r; return r;
}, },
'VARPA' : function(){ 'VARPA' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("VARPA");
r.setName("VARPA");
return r; return r;
}, },
'WEIBULL' : function(){ 'WEIBULL' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("WEIBULL");
r.setName("WEIBULL");
return r; return r;
}, },
'ZTEST' : function(){ 'ZTEST' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ZTEST");
r.setName("ZTEST");
return r; return r;
} }
}, },
TextAndData:{ TextAndData:{
'groupName' : "TextAndData", 'groupName' : "TextAndData",
'ASC' : function(){ 'ASC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("ASC");
r.setName("ASC");
return r; return r;
}, },
'BAHTTEXT' : function(){ 'BAHTTEXT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("BAHTTEXT");
r.setName("BAHTTEXT");
return r; return r;
}, },
'CHAR' : function(){ 'CHAR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CHAR");
r.setName("CHAR");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7823,8 +7720,7 @@ var cFormulaFunction = { ...@@ -7823,8 +7720,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'CLEAN' : function(){ 'CLEAN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CLEAN");
r.setName("CLEAN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7857,8 +7753,7 @@ var cFormulaFunction = { ...@@ -7857,8 +7753,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'CODE' : function(){ 'CODE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CODE");
r.setName("CODE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7899,8 +7794,7 @@ var cFormulaFunction = { ...@@ -7899,8 +7794,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'CONCATENATE' : function(){ 'CONCATENATE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("CONCATENATE");
r.setName("CONCATENATE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(255); r.setArgumentsMax(255);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7942,8 +7836,7 @@ var cFormulaFunction = { ...@@ -7942,8 +7836,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'DOLLAR' : function(){ 'DOLLAR' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("DOLLAR");
r.setName("DOLLAR");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -7962,8 +7855,7 @@ var cFormulaFunction = { ...@@ -7962,8 +7855,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'EXACT' : function(){ 'EXACT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("EXACT");
r.setName("EXACT");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8004,8 +7896,7 @@ var cFormulaFunction = { ...@@ -8004,8 +7896,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'FIND' : function(){ 'FIND' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FIND");
r.setName("FIND");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8083,8 +7974,7 @@ var cFormulaFunction = { ...@@ -8083,8 +7974,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'FIXED' : function(){ 'FIXED' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("FIXED");
r.setName("FIXED");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8250,13 +8140,11 @@ var cFormulaFunction = { ...@@ -8250,13 +8140,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'JIS' : function(){ 'JIS' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("JIS");
r.setName("JIS");
return r; return r;
}, },
'LEFT' : function(){ 'LEFT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LEFT");
r.setName("LEFT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8304,8 +8192,7 @@ var cFormulaFunction = { ...@@ -8304,8 +8192,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'LEN' : function(){ 'LEN' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LEN");
r.setName("LEN");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8339,8 +8226,7 @@ var cFormulaFunction = { ...@@ -8339,8 +8226,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'LOWER' : function(){ 'LOWER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("LOWER");
r.setName("LOWER");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8366,8 +8252,7 @@ var cFormulaFunction = { ...@@ -8366,8 +8252,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'MID' : function(){ 'MID' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("MID");
r.setName("MID");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8427,13 +8312,11 @@ var cFormulaFunction = { ...@@ -8427,13 +8312,11 @@ var cFormulaFunction = {
return r; return r;
}, },
'PHONETIC' : function(){ 'PHONETIC' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PHONETIC");
r.setName("PHONETIC");
return r; return r;
}, },
'PROPER' : function(){ 'PROPER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("PROPER");
r.setName("PROPER");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8496,8 +8379,7 @@ var cFormulaFunction = { ...@@ -8496,8 +8379,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'REPLACE' : function(){ 'REPLACE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("REPLACE");
r.setName("REPLACE");
r.setArgumentsMin(4); r.setArgumentsMin(4);
r.setArgumentsMax(4); r.setArgumentsMax(4);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8577,8 +8459,7 @@ var cFormulaFunction = { ...@@ -8577,8 +8459,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'REPT' : function(){ 'REPT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("REPT");
r.setName("REPT");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8635,8 +8516,7 @@ var cFormulaFunction = { ...@@ -8635,8 +8516,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'RIGHT' : function(){ 'RIGHT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("RIGHT");
r.setName("RIGHT");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8684,8 +8564,7 @@ var cFormulaFunction = { ...@@ -8684,8 +8564,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'SEARCH' : function(){ 'SEARCH' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SEARCH");
r.setName("SEARCH");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(3); r.setArgumentsMax(3);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8768,8 +8647,7 @@ var cFormulaFunction = { ...@@ -8768,8 +8647,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'SUBSTITUTE' : function(){ 'SUBSTITUTE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("SUBSTITUTE");
r.setName("SUBSTITUTE");
r.setArgumentsMin(3); r.setArgumentsMin(3);
r.setArgumentsMax(4); r.setArgumentsMax(4);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8847,8 +8725,7 @@ var cFormulaFunction = { ...@@ -8847,8 +8725,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'T' : function(){ 'T' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("T");
r.setName("T");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8879,8 +8756,7 @@ var cFormulaFunction = { ...@@ -8879,8 +8756,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'TEXT' : function(){ 'TEXT' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TEXT");
r.setName("TEXT");
r.setArgumentsMin(2); r.setArgumentsMin(2);
r.setArgumentsMax(2); r.setArgumentsMax(2);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8942,8 +8818,7 @@ var cFormulaFunction = { ...@@ -8942,8 +8818,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'TRIM' : function(){ 'TRIM' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("TRIM");
r.setName("TRIM");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8972,8 +8847,7 @@ var cFormulaFunction = { ...@@ -8972,8 +8847,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'UPPER' : function(){ 'UPPER' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("UPPER");
r.setName("UPPER");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -8998,8 +8872,7 @@ var cFormulaFunction = { ...@@ -8998,8 +8872,7 @@ var cFormulaFunction = {
return r; return r;
}, },
'VALUE' : function(){ 'VALUE' : function(){
var r = new cBaseFunction(); var r = new cBaseFunction("VALUE");
r.setName("VALUE");
r.setArgumentsMin(1); r.setArgumentsMin(1);
r.setArgumentsMax(1); r.setArgumentsMax(1);
r.Calculate = function(arg){ r.Calculate = function(arg){
...@@ -9320,6 +9193,14 @@ cArea.prototype.countCells = function(){ ...@@ -9320,6 +9193,14 @@ cArea.prototype.countCells = function(){
}) })
return new cNumber( count ); return new cNumber( count );
}; };
cArea.prototype.foreach = function(action){
var _val = [], r = this.getRange();
if( !r ){
_val.push(new cError(cErrorType.bad_reference))
}
else
r._foreach2(action)
}
/** @constructor */ /** @constructor */
function cRef(val,_ws){/*Ref means A1 for example*/ function cRef(val,_ws){/*Ref means A1 for example*/
...@@ -9766,7 +9647,7 @@ cArray.prototype.getElement = function(index){ ...@@ -9766,7 +9647,7 @@ cArray.prototype.getElement = function(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 true; }
for( var ir = 0; ir < this.rowCount; ir++ ){ for( var ir = 0; ir < this.rowCount; ir++ ){
for( var ic = 0; ic < this.countElementInRow[ir]; ic++){ for( var ic = 0; ic < this.countElementInRow[ir]; ic++){
if( action.call(this,this.array[ir][ic],ir,ic) ) if( action.call(this,this.array[ir][ic],ir,ic) )
......
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