From 01987b85a17532c6105c401ba5234a2d2b966eea Mon Sep 17 00:00:00 2001 From: Adam Morris Date: Sat, 16 Jan 2021 21:04:44 +0800 Subject: [PATCH] array literals not showing arraystop arrayrowstop --- src/ExcelFormulaUtilities.js | 7 ++++++- test/ExcelFormulaUtilities.test.js | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ExcelFormulaUtilities.js b/src/ExcelFormulaUtilities.js index 0e0cf2b..a1558fa 100644 --- a/src/ExcelFormulaUtilities.js +++ b/src/ExcelFormulaUtilities.js @@ -185,7 +185,6 @@ while (!EOF()) { - // state-dependent character evaluation (order is important) // double-quoted strings // embeds are doubled @@ -783,6 +782,12 @@ case "ARRAYROW": tokenString = formatStr(replaceTokenTmpl(options.tmplFunctionStartArrayRow), tokenString, indent, lineBreak); break; + case "ARRAYSTOP": + tokenString = formatStr(replaceTokenTmpl(options.tmplFunctionStopArray), tokenString, indent, lineBreak); + break; + case "ARRAYROWSTOP": + tokenString = formatStr(replaceTokenTmpl(options.tmplFunctionStopArrayRow), tokenString, indent, lineBreak); + break; default: if (token.subtype.toString() === "start") { tokenString = formatStr(replaceTokenTmpl(options.tmplFunctionStart), tokenString, indent, lineBreak); diff --git a/test/ExcelFormulaUtilities.test.js b/test/ExcelFormulaUtilities.test.js index 6ebc01a..2fc0761 100644 --- a/test/ExcelFormulaUtilities.test.js +++ b/test/ExcelFormulaUtilities.test.js @@ -53,4 +53,13 @@ describe("ExcelFormulaUtilities", () => { }) }) + describe("#arrayliterals", () => { + it("Test parsing a formula that contains array literals. From Issue #89", () => { + let inputFormula='={A1:C2,B2:C3}'; + let expected = '={ A1:C2,
        B2:C3}'; + let actual = formula.formatFormulaHTML(inputFormula); + assert.equal(actual, expected); + }) + }) + })