diff --git a/cell/model/FormulaObjects/parserFormula.js b/cell/model/FormulaObjects/parserFormula.js index dd448ab381..a2271e6363 100644 --- a/cell/model/FormulaObjects/parserFormula.js +++ b/cell/model/FormulaObjects/parserFormula.js @@ -75,7 +75,7 @@ function (window, undefined) { var arrayFunctionsMap = {"SUMPRODUCT": 1, "FILTER": 1, "SUM": 1, "LOOKUP": 1, "AGGREGATE": 1}; var importRangeLinksState = {importRangeLinks: null, startBuildImportRangeLinks: null}; - const aExcludeRecursiveFormulas = ['ISFORMULA', 'SHEETS', 'AREAS', 'COLUMN', 'COLUMNS', 'ROW', 'ROWS', 'CELL', 'OFFSET']; + const aExcludeRecursiveFormulas = ['ISFORMULA','SHEET','SHEETS', 'AREAS', 'COLUMN', 'COLUMNS', 'ROW', 'ROWS', 'CELL', 'OFFSET']; const cReplaceFormulaType = { val: 1, diff --git a/cell/model/Workbook.js b/cell/model/Workbook.js index 5ce843af51..e76722a59b 100644 --- a/cell/model/Workbook.js +++ b/cell/model/Workbook.js @@ -15821,19 +15821,19 @@ let oArgElem = aOutStack[j]; let oBbox = null; let aRef = [cElementType.cell, cElementType.cell3D, cElementType.cellsRange, cElementType.cellsRange3D]; - if (!aRef.includes(oArgElem.type)) { - continue; - } + if (oArgElem.type === cElementType.name || oArgElem.type === cElementType.name3D) { const oElemValue = oArgElem.getValue(); if (!aRef.includes(oElemValue.type)) { continue; } oBbox = oElemValue.getBBox0(); - } else { + } else if (oArgElem.type === cElementType.table) { + oBbox = oArgElem.getRange().getBBox0(); + } else if (aRef.includes(oArgElem.type)) { oBbox = oArgElem.getBBox0(); } - bBelongToFormula = oAreaMap.bbox.isIntersect(oBbox); + bBelongToFormula = !!oBbox && oAreaMap.bbox.isIntersect(oBbox); if (bBelongToFormula) { return true; } diff --git a/tests/cell/spreadsheet-calculation/FormulaTests.js b/tests/cell/spreadsheet-calculation/FormulaTests.js index 5a89593fc6..17dea12cac 100644 --- a/tests/cell/spreadsheet-calculation/FormulaTests.js +++ b/tests/cell/spreadsheet-calculation/FormulaTests.js @@ -2195,6 +2195,17 @@ $(function () { assert.strictEqual(bCellHasRecursion, false, "Test: Formula INDIRECT Ref3D isn't recursive cell with disabled setting. Bug-76318. A1134 - false"); bCellHasRecursion = null; wb.removeWorksheet(0); + // - Case: Formula SHEET isn't recursive cell with disabled setting. Bug-77330 + ws2 = wb.createWorksheet(0, "Sheet2"); + let oDefNameSHEET = new Asc.asc_CDefName("TestSHEET", ws2.getName() + "!$A$2:$E$5"); + wb.editDefinesNames(null, oDefNameSHEET); + ws.getRange2("A1135").setValue('=SHEET(TestSHEET)'); + oCell = selectCell("A1135"); + bCellHasRecursion = !!getStartCellForIterCalc(oCell); + assert.strictEqual(bCellHasRecursion, false, "Test: Formula SHEET isn't recursive cell with disabled setting. Bug-77330. A1135 - false"); + bCellHasRecursion = null; + wb.delDefinesNames(oDefNameSHEET); + wb.removeWorksheet(0); // -- Test changeLinkedCell method. oCell = selectCell("A1000"); let oCellNeedEnableRecalc = selectCell("B1000");