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

поправлена функция INDEX

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@67053 954022d7-b5bf-4e40-9824-e11837661b57
parent 7ca8a9f0
......@@ -499,13 +499,27 @@ cINDEX.prototype.Calculate = function ( arg ) {
return this.value = new cError( cErrorType.wrong_value_type );
}
if ( arg0 instanceof cArray || arg0 instanceof cArea ) {
if ( arg0 instanceof cArray ) {
var _a_ = arg0.getMatrix();
if ( _a_.length == 1 ) {/*одна строка*/
res = arg0.getValue2( 0, arg1 - 1 );
}
else {
res = arg0.getValue2( arg1 - 1, arg2 - 1 );
res = arg0.getValue2( arg1 == 0 ? 0 : arg1 - 1, arg2 == 0 ? 0 : arg2 - 1 );
}
}
else if( arg0 instanceof cArea ){
var _a_ = arg0.getRefMatrix();
if ( _a_.length == 1 ) {/*одна строка*/
res = _a_[0][arg1 - 1];
}
else {
if ( arg1 == 0 && arg2 > 0 ) {
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 ( arg0 instanceof cRef || arg0 instanceof cRef3D ) {
......
......@@ -680,6 +680,15 @@ cArea.prototype.getMatrix = function () {
} );
return arr;
};
cArea.prototype.getRefMatrix = function () {
var t = this, arr = [], r = this.getRange();
r._foreach2( function ( cell, i, j, r1, c1 ) {
if ( !arr[i - r1] )
arr[i - r1] = [];
arr[i - r1][j - c1] = new cRef( cell.getName(), t.ws );
} );
return arr;
};
cArea.prototype.index = function ( r, c, n ) {
var bbox = this.getBBox0();
bbox.normalize();
......
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