Skip to content

Commit

Permalink
[se] Add Range._getNoEmptyBBox
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Feb 11, 2025
1 parent 9e29e8d commit dcd4a2e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
17 changes: 17 additions & 0 deletions cell/model/FormulaObjects/parserFormula.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,23 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
var ws = r.worksheet;
var oldExcludeHiddenRows = ws.bExcludeHiddenRows;
ws.bExcludeHiddenRows = false;

// let bbox = r._getNoEmptyBBox(r.bbox);
// //todo bbox.r1 может быть меньше r.bbox.r1. рассчитывает ли функции выше что getMatrix возвращает от r.bbox.r1
// for (let i = 0; i < bbox.r2 - bbox.r1 + 1; ++i) {
// arr[i] = [];
// for (let j = 0; j < bbox.c2 - bbox.c1 + 1; ++j) {
// arr[i][j] = new cEmpty();
// }
// }
// r._foreachNoEmptyData(function (cell, i, j, r1, c1) {
// if(!(excludeNestedStAg && cell.formulaParsed && cell.formulaParsed.isFoundNestedStAg())){
// var checkTypeVal = checkTypeCell(cell);
// if(!(excludeErrorsVal && CellValueType.Error === checkTypeVal.type)){
// arr[i - bbox.r1][j - bbox.c1] = checkTypeVal;
// }
// }
// });
r._foreach2(function (cell, i, j, r1, c1) {
if (!arr[i - r1]) {
arr[i - r1] = [];
Expand Down
22 changes: 21 additions & 1 deletion cell/model/Workbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@
for (var name in changedSheet) {
if (changedSheet.hasOwnProperty(name)) {
bbox = changedSheet[name];
ws.getRange3(bbox.r1, bbox.c1, bbox.r2, bbox.c2)._foreachNoEmpty(callback);
ws.getRange3(bbox.r1, bbox.c1, bbox.r2, bbox.c2)._foreachNoEmptyData(callback);
}
}
}
Expand Down Expand Up @@ -17655,6 +17655,26 @@
return this._foreachNoEmpty(actionCell);
}
};
Range.prototype._getNoEmptyBBox=function(bbox){
let r1 = gc_nMaxRow0 + 1;
let r2 = -1;
let c1 = gc_nMaxCol0 + 1;
let c2 = -1;
for (let i = bbox.c1; i <= bbox.c2; ++i) {
let sheetMemory = this.worksheet.cellsByCol[i];
if (sheetMemory) {
c1 = Math.min(c1, i);
c2 = Math.max(c2, i);
r1 = Math.min(r1, sheetMemory.getMinIndex());
r2 = Math.max(r2, sheetMemory.getMaxIndex());
}
}
if (r1 <= r2 && c1 <= c2) {
return new Asc.Range(c1, r1, c2, r2);
} else {
return null;
}
};
Range.prototype._getRangeType=function(oBBox){
if(null == oBBox)
oBBox = this.bbox;
Expand Down

0 comments on commit dcd4a2e

Please sign in to comment.