Commit 3a3a5050 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 33627

SUBTOTAL now calculate with check hidden row (https://support.office.com/en-us/article/SUBTOTAL-function-7b027003-f060-4ade-9040-e478765b9939)
bIsApplyFilterBySheet  -> isApplyFilterBySheet
parent 72947729
......@@ -960,14 +960,17 @@ cArea.prototype.clone = function () {
cArea.prototype.getWsId = function () {
return this.ws.Id;
};
cArea.prototype.getValue = function () {
cArea.prototype.getValue = function (checkExclude, excludeHiddenRows) {
var val = [], r = this.getRange();
if (!r) {
val.push(new cError(cErrorType.bad_reference));
} else {
if (checkExclude && !excludeHiddenRows) {
excludeHiddenRows = this.ws.isApplyFilterBySheet();
}
r._foreachNoEmpty(function (cell) {
val.push(checkTypeCell(cell));
});
}, excludeHiddenRows);
}
return val;
};
......@@ -980,12 +983,12 @@ cArea.prototype.getWsId = function () {
}
return res;
};
cArea.prototype.getRange = function () {
if ( !this.range ) {
this.range = this.ws.getRange2( this._cells )
}
return this.range;
};
cArea.prototype.getRange = function () {
if (!this.range) {
this.range = this.ws.getRange2(this._cells);
}
return this.range;
};
cArea.prototype.tocNumber = function () {
var v = this.getValue()[0];
if ( !v ) {
......@@ -1174,7 +1177,7 @@ cArea3D.prototype.wsRange = function () {
cArea3D.prototype.getRanges = function () {
return (this.range(this.wsRange()));
};
cArea3D.prototype.getValue = function () {
cArea3D.prototype.getValue = function (checkExclude, excludeHiddenRows) {
var i, _wsA = this.wsRange();
var _val = [];
if (_wsA.length < 1) {
......@@ -1188,15 +1191,19 @@ cArea3D.prototype.wsRange = function () {
}
}
var _exclude;
var _r = this.range(_wsA);
for (i = 0; i < _r.length; i++) {
if (!_r[i]) {
_val.push(new cError(cErrorType.bad_reference));
return _val;
}
if (checkExclude && !(_exclude = excludeHiddenRows)) {
_exclude = _wsA[i].isApplyFilterBySheet();
}
_r[i]._foreachNoEmpty(function (cell) {
_val.push(checkTypeCell(cell));
});
}, _exclude);
}
return _val;
};
......@@ -1356,25 +1363,25 @@ cArea3D.prototype.getWS = function () {
return this.wsFrom === this.wsTo;
};
/** @constructor */
function cRef( val, ws ) {/*Ref means A1 for example*/
this.constructor.call( this, val, cElementType.cell );
this._cells = val;
this.ws = ws;
this.wb = this._wb = ws.workbook;
this.isAbsolute = false;
this.isAbsoluteCol1 = false;
this.isAbsoluteRow1 = false;
var ca = g_oCellAddressUtils.getCellAddress(val.replace(AscCommon.rx_space_g, ""));
this.range = null;
this._valid = ca.isValid();
if ( this._valid ) {
this.range = this.ws.getRange3( ca.getRow0(), ca.getCol0(), ca.getRow0(), ca.getCol0() );
} else {
this.range = this.ws.getRange3( 0, 0, 0, 0 );
}
}
/** @constructor */
function cRef(val, ws) {/*Ref means A1 for example*/
this.constructor.call(this, val, cElementType.cell);
this._cells = val;
this.ws = ws;
this.wb = this._wb = ws.workbook;
this.isAbsolute = false;
this.isAbsoluteCol1 = false;
this.isAbsoluteRow1 = false;
var ca = g_oCellAddressUtils.getCellAddress(val.replace(AscCommon.rx_space_g, ""));
this.range = null;
this._valid = ca.isValid();
if (this._valid) {
this.range = this.ws.getRange3(ca.getRow0(), ca.getCol0(), ca.getRow0(), ca.getCol0());
} else {
this.range = this.ws.getRange3(0, 0, 0, 0);
}
}
cRef.prototype = Object.create( cBaseType.prototype );
cRef.prototype.clone = function () {
......@@ -1408,9 +1415,9 @@ cRef.prototype.tocBool = function () {
cRef.prototype.toString = function () {
return this._cells;
};
cRef.prototype.getRange = function () {
return this.range;
};
cRef.prototype.getRange = function () {
return this.range;
};
cRef.prototype.getWS = function () {
return this.ws;
};
......@@ -1423,18 +1430,24 @@ cRef.prototype.getMatrix = function () {
cRef.prototype.getBBox0 = function () {
return this.getRange().getBBox0();
};
cRef.prototype.isHidden = function (excludeHiddenRows) {
if (!excludeHiddenRows) {
excludeHiddenRows = this.ws.isApplyFilterBySheet();
}
return excludeHiddenRows && this._valid && this.ws.getRowHidden(this.getRange().r1);
};
/** @constructor */
function cRef3D( val, _wsFrom, wb ) {/*Ref means Sheat1!A1 for example*/
this.constructor.call( this, val, cElementType.cell3D );
this.wb = this._wb = wb;
this._cells = val;
this.isAbsolute = false;
this.isAbsoluteCol1 = false;
this.isAbsoluteRow1 = false;
this.ws = this._wb.getWorksheetByName( _wsFrom );
this.range = null;
}
/** @constructor */
function cRef3D(val, _wsFrom, wb) {/*Ref means Sheat1!A1 for example*/
this.constructor.call(this, val, cElementType.cell3D);
this.wb = this._wb = wb;
this._cells = val;
this.isAbsolute = false;
this.isAbsoluteCol1 = false;
this.isAbsoluteRow1 = false;
this.ws = this._wb.getWorksheetByName(_wsFrom);
this.range = null;
}
cRef3D.prototype = Object.create( cBaseType.prototype );
cRef3D.prototype.clone = function () {
......@@ -1449,16 +1462,16 @@ cRef3D.prototype.clone = function () {
cRef3D.prototype.getWsId = function () {
return this.ws.Id;
};
cRef3D.prototype.getRange = function () {
if ( this.ws ) {
if ( this.range ) {
return this.range;
}
return this.range = this.ws.getRange2( this._cells );
} else {
return this.range = null;
}
};
cRef3D.prototype.getRange = function () {
if (this.ws) {
if (this.range) {
return this.range;
}
return this.range = this.ws.getRange2(this._cells);
} else {
return this.range = null;
}
};
cRef3D.prototype.isValid = function () {
return !!this.getRange();
};
......@@ -1496,6 +1509,13 @@ cRef3D.prototype.getBBox0 = function () {
}
return null;
};
cRef3D.prototype.isHidden = function (excludeHiddenRows) {
if (!excludeHiddenRows) {
excludeHiddenRows = this.ws.isApplyFilterBySheet();
}
var _r = this.getRange();
return excludeHiddenRows && _r && this.ws.getRowHidden(_r.r1);
};
/** @constructor */
function cEmpty() {
......
......@@ -5465,7 +5465,7 @@ Woorksheet.prototype.getTableNameColumnByIndex = function(tableName, columnIndex
}
return res;
};
Woorksheet.prototype.bIsApplyFilterBySheet = function(){
Woorksheet.prototype.isApplyFilterBySheet = function(){
var res = false;
if(this.AutoFilter && this.AutoFilter.isApplyAutoFilter())
......
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