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 @@
oParser = new parserFormula( "INDEX(A651:C655,,2)", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 6 );
strictEqual( oParser.calculate().getValue().getValue(), 6 );
oParser = new parserFormula( "INDEX(A651:C655,3,2)", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 8 );
strictEqual( oParser.calculate().getValue().getValue(), 8 );
oParser = new parserFormula( "INDEX(A651:C655,10,2)", "A2", ws );
ok( oParser.parse() );
......
......@@ -518,8 +518,13 @@ cINDEX.prototype.Calculate = function ( arg ) {
var _a1 = _a_[0][arg2 - 1], _a2 = _a_[_a_.length - 1][arg2 - 1];
res = new cArea( _a1.toString() + ":" + _a2.toString(), _a1.ws );
}
else
res = _a_[arg1 - 1][arg2 - 1];
else{
if( arg1 > _a_.length || arg2 > _a_[0].length ){
res = new cError( cErrorType.bad_reference );
}
else
res = _a_[arg1 - 1][arg2 - 1];
}
}
}
else if ( arg0 instanceof cRef || arg0 instanceof cRef3D ) {
......
......@@ -682,7 +682,7 @@ cArea.prototype.getMatrix = function () {
};
cArea.prototype.getRefMatrix = function () {
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] )
arr[i - r1] = [];
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