Commit d41fccd3 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@61010 954022d7-b5bf-4e40-9824-e11837661b57
parent a5ee5ab4
......@@ -481,14 +481,23 @@ cINDEX.prototype.Calculate = function ( arg ) {
return this.value = new cError(cErrorType.wrong_value_type);
}
if (arg1.getValue() < 0 || arg2.getValue() < 0) {
arg1 = arg1.getValue();
arg2 = arg2.getValue();
arg3 = arg3.getValue();
if (arg1 < 0 || arg2 < 0) {
return this.value = new cError(cErrorType.wrong_value_type);
}
if (arg0 instanceof cArray || arg0 instanceof cArea) {
res = arg0.getValue2(arg1.getValue() - 1, arg2.getValue() - 1);
} else {
res = arg0.tryConvert();
res = arg0.getValue2(arg1 - 1, arg2 - 1);
} else if( arg0 instanceof cRef || arg0 instanceof cRef3D ){
if( (arg1 == 0 || arg1 == 1) && (arg2 ==0 || arg2 == 1) ){
res = arg0.tryConvert();
}
}
else{
res = new cError(cErrorType.wrong_value_type);
}
return this.value = res ? res : new cError(cErrorType.bad_reference);
......
......@@ -504,9 +504,13 @@ cArea.prototype.getValue = function () {
return val;
};
cArea.prototype.getValue2 = function (i, j) {
var r = this.getRange();
var cell = r.worksheet._getCellNoEmpty(r.bbox.r1 + i, r.bbox.c1 + j);
return this._parseCellValue(cell);
var res = this.index( i+1, j+1 ), r, cell;
if( !res ){
r = this.getRange();
cell = r.worksheet._getCellNoEmpty(r.bbox.r1 + i, r.bbox.c1 + j);
res = this._parseCellValue(cell);
}
return res;
};
cArea.prototype.getRange = function () {
if( !this.range ){
......@@ -630,7 +634,7 @@ cArea.prototype.getMatrix = function () {
return arr;
};
cArea.prototype.index = function ( r, c, n ) {
var bbox = this.getBBox();
var bbox = this.getBBox0();
bbox.normalize();
var box = {c1:1, c2:bbox.c2-bbox.c1+1, r1:1, r2:bbox.r2-bbox.r1+1};
......
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