Commit 2404567a authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

fixed INDEX formula

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@67593 954022d7-b5bf-4e40-9824-e11837661b57
parent ff33cb9f
...@@ -3294,11 +3294,11 @@ ...@@ -3294,11 +3294,11 @@
oParser = new parserFormula( "INDEX(A651:C655,,2)", "A2", ws ); oParser = new parserFormula( "INDEX(A651:C655,,2)", "A2", ws );
ok( oParser.parse() ); ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 6 ); strictEqual( oParser.calculate().getValue().getValue(), 6 );
oParser = new parserFormula( "INDEX(A651:C655,3,2)", "A2", ws ); oParser = new parserFormula( "INDEX(A651:C655,3,2)", "A2", ws );
ok( oParser.parse() ); ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 8 ); strictEqual( oParser.calculate().getValue().getValue(), 8 );
oParser = new parserFormula( "INDEX(A651:C655,10,2)", "A2", ws ); oParser = new parserFormula( "INDEX(A651:C655,10,2)", "A2", ws );
ok( oParser.parse() ); ok( oParser.parse() );
......
...@@ -518,10 +518,15 @@ cINDEX.prototype.Calculate = function ( arg ) { ...@@ -518,10 +518,15 @@ cINDEX.prototype.Calculate = function ( arg ) {
var _a1 = _a_[0][arg2 - 1], _a2 = _a_[_a_.length - 1][arg2 - 1]; var _a1 = _a_[0][arg2 - 1], _a2 = _a_[_a_.length - 1][arg2 - 1];
res = new cArea( _a1.toString() + ":" + _a2.toString(), _a1.ws ); res = new cArea( _a1.toString() + ":" + _a2.toString(), _a1.ws );
} }
else{
if( arg1 > _a_.length || arg2 > _a_[0].length ){
res = new cError( cErrorType.bad_reference );
}
else else
res = _a_[arg1 - 1][arg2 - 1]; res = _a_[arg1 - 1][arg2 - 1];
} }
} }
}
else if ( arg0 instanceof cRef || arg0 instanceof cRef3D ) { else if ( arg0 instanceof cRef || arg0 instanceof cRef3D ) {
if ( (arg1 == 0 || arg1 == 1) && (arg2 == 0 || arg2 == 1) ) { if ( (arg1 == 0 || arg1 == 1) && (arg2 == 0 || arg2 == 1) ) {
res = arg0.tryConvert(); res = arg0.tryConvert();
......
...@@ -682,7 +682,7 @@ cArea.prototype.getMatrix = function () { ...@@ -682,7 +682,7 @@ cArea.prototype.getMatrix = function () {
}; };
cArea.prototype.getRefMatrix = function () { cArea.prototype.getRefMatrix = function () {
var t = this, arr = [], r = this.getRange(); var t = this, arr = [], r = this.getRange();
r._foreach2( function ( cell, i, j, r1, c1 ) { r._foreach( function ( cell, i, j, r1, c1 ) {
if ( !arr[i - r1] ) if ( !arr[i - r1] )
arr[i - r1] = []; arr[i - r1] = [];
arr[i - r1][j - c1] = new cRef( cell.getName(), t.ws ); arr[i - r1][j - c1] = new cRef( cell.getName(), t.ws );
......
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