From 41814346cb23098532604fbe9c3e1078741b1a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ossian=20Edstr=C3=B6m?= Date: Tue, 7 Jul 2026 16:56:16 +0200 Subject: [PATCH 1/3] Tracking down the issue --- .../Issues/FormulaCalculationIssues.cs | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/EPPlusTest/Issues/FormulaCalculationIssues.cs b/src/EPPlusTest/Issues/FormulaCalculationIssues.cs index 149b54db1..a0ec890eb 100644 --- a/src/EPPlusTest/Issues/FormulaCalculationIssues.cs +++ b/src/EPPlusTest/Issues/FormulaCalculationIssues.cs @@ -1666,6 +1666,88 @@ public void s1050() SaveWorkbook("s1050-saved.xlsx", p); } } + [TestMethod] + public void s1063() + { + using (var p = OpenTemplatePackage("issues\\s1063.xlsx")) + { + var ws = p.Workbook.Worksheets[0]; + + //ws.Calculate(); + + // Output from the logger will be written to the following file + var logfile = new FileInfo(@"c:\temp\logfiles1063LET.txt"); + p.Workbook.FormulaParserManager.AttachLogger(logfile); + + ws.Cells["R14"].CreateArrayFormula("LET(wbsElement,CHOOSECOLS(ANCHORARRAY(L14),5),wbsElement)", true); + + //START HERE: This works but adding IfError fucks it up + ws.Cells["S14"].CreateArrayFormula("= LET(wbsElement, CHOOSECOLS(ANCHORARRAY(L14),5),LET(" + + "wbsPositionDot1, SEARCH(\".\",wbsElement, 1)," + + "wbsPositionDot2,SEARCH(\".\", wbsElement, wbsPositionDot1+1)," + + "wbsPositionDot3, SEARCH(\".\", wbsElement, wbsPositionDot2+1)," + + "wbsPositionDot1* wbsPositionDot2*wbsPositionDot3))", true); + + //ws.Cells["S14"].CreateArrayFormula("LET" + + // "(" + + // "wbsElement," + + // "CHOOSECOLS(ANCHORARRAY(L14),5)," + + // "LET(" + + // "wbsPositionDot1, " + + // "IFERROR(SEARCH(\".\", wbsElement, 1),0)," + + // "wbsPositionDot2, " + + // "IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot1+1),0)," + + // "wbsPositionDot3, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot2+1),0)," + + // "wbsPositionDot1*wbsPositionDot2*wbsPositionDot3)" + + // ")" + // , true); + //ws.Cells["R14"].Formula = "xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))"; + //ws.Cells["R14"].CreateArrayFormula("xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))", true); + + ws.Cells["R14:R16"].Calculate(); + + //ws.Cells["R14"].Calculate(); + //ws.Cells["R15"].Calculate(); + + //var myValue = ws.Cells["R14"].Value; + //var secondValue = ws.Cells["R15"].Value; + //var firstVal = + //var secondVal + //ws.Cells["R14:R16"].Calculate(); + var myValues = ws.Cells["R14:R16"].Value; + + Assert.AreEqual("RDPMS.CH10.001", ws.Cells["R14"].Value); + Assert.AreEqual("R.100.200.300", ws.Cells["R15"].Value); + Assert.AreEqual("R.200.300.400", ws.Cells["R16"].Value); + + ws.Cells["S14:S16"].Calculate(); + + var value = ws.Cells["S14:S16"].Value; + + ws.Cells["Q15"].Calculate(); + p.Workbook.FormulaParserManager.DetachLogger(); + var cellValues2 = ws.Cells["Q15"].Value; + + //ws.Calculate(); + + //var cellValues = ws.Cells["A1:A3"].Value; + + //var cellValues2 = ws.Cells["Q15"].Value; + + List extractedValues = new List(); + + foreach(var cell in ws.Cells["A1:A3"]) + { + extractedValues.Add(cell.GetValue()); + } + + //p.Workbook.FullCalcOnLoad = false; + p.Workbook.CalcMode = ExcelCalcMode.Manual; + + SaveWorkbook("s1063-saved.xlsx", p); + } + } + [TestMethod] public void s1054() From 7896abb7558d74789d242a2b13fa4d69f19570b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ossian=20Edstr=C3=B6m?= Date: Wed, 8 Jul 2026 14:54:18 +0200 Subject: [PATCH 2/3] Found main issue. Arrays 3rd arg Search function --- .../Excel/Functions/Text/Search.cs | 2 +- .../Issues/FormulaCalculationIssues.cs | 169 ++++++++++++------ 2 files changed, 120 insertions(+), 51 deletions(-) diff --git a/src/EPPlus/FormulaParsing/Excel/Functions/Text/Search.cs b/src/EPPlus/FormulaParsing/Excel/Functions/Text/Search.cs index 7ead6b262..93906f319 100644 --- a/src/EPPlus/FormulaParsing/Excel/Functions/Text/Search.cs +++ b/src/EPPlus/FormulaParsing/Excel/Functions/Text/Search.cs @@ -29,7 +29,7 @@ internal class Search : ExcelFunction public override ExcelFunctionArrayBehaviour ArrayBehaviour => ExcelFunctionArrayBehaviour.Custom; public override void ConfigureArrayBehaviour(ArrayBehaviourConfig config) { - config.SetArrayParameterIndexes(0, 1); + config.SetArrayParameterIndexes(0, 1, 2); } public override int ArgumentMinLength => 2; diff --git a/src/EPPlusTest/Issues/FormulaCalculationIssues.cs b/src/EPPlusTest/Issues/FormulaCalculationIssues.cs index a0ec890eb..e8b9ea1d9 100644 --- a/src/EPPlusTest/Issues/FormulaCalculationIssues.cs +++ b/src/EPPlusTest/Issues/FormulaCalculationIssues.cs @@ -1666,6 +1666,43 @@ public void s1050() SaveWorkbook("s1050-saved.xlsx", p); } } + + [TestMethod] + public void s1063_Isolated() + { + using (var p = OpenPackage("Search3ArgsArrays.xlsx", true)) + { + var ws = p.Workbook.Worksheets.Add("args"); + + ws.Cells["A1:A3"].Formula = "\"I.am.a.Beautiful.Creature\" & ROW()"; + + ws.Cells["A1:A3"].Calculate(); + + ws.Cells["B1:B3"].Formula = "(ROW()-1)*2 + 1"; + ws.Cells["B1:B3"].Calculate(); + + ws.Cells["C1"].CreateArrayFormula("SEARCH(\".\",A1:A3,B1:B3+1)", true); + ws.Cells["C1"].Calculate(); + + var range = ws.Cells["C1:C3"]; + + var myValues = ws.Cells["C1:C3"].Value; + + List intValues = new List(); + + foreach(var cell in range) + { + intValues.Add(cell.GetValue()); + } + + Assert.AreEqual(2, intValues[0]); + Assert.AreEqual(5, intValues[1]); + Assert.AreEqual(7, intValues[2]); + + SaveAndCleanup(p); + } + } + [TestMethod] public void s1063() { @@ -1677,69 +1714,101 @@ public void s1063() // Output from the logger will be written to the following file var logfile = new FileInfo(@"c:\temp\logfiles1063LET.txt"); + + ws.Cells["T14"].CreateArrayFormula("CHOOSECOLS(ANCHORARRAY(L14),5)", true); + + ws.Cells["T14"].Calculate(); + + var testInitial = ws.Cells["T14:T16"].Value; + + ws.Cells["U14"].CreateArrayFormula("SEARCH(\".\", CHOOSECOLS(ANCHORARRAY(L14),5), 1)", true); + + ws.Cells["U14"].Calculate(); + + var test = ws.Cells["U14:U16"].Value; + p.Workbook.FormulaParserManager.AttachLogger(logfile); - ws.Cells["R14"].CreateArrayFormula("LET(wbsElement,CHOOSECOLS(ANCHORARRAY(L14),5),wbsElement)", true); + ws.Cells["V14"].CreateArrayFormula("SEARCH(\".\",ANCHORARRAY(T14),(ANCHORARRAY(U14)+1))",true); + //ws.Cells["V14"].UseImplicitItersection = false; + ws.Cells["V14"].Calculate(); + + var resultsTheory = ws.Cells["V14:V16"].Value; + + //ws.Cells["R14"].CreateArrayFormula("LET(wbsElement,CHOOSECOLS(ANCHORARRAY(L14),5),wbsElement)", true); //START HERE: This works but adding IfError fucks it up - ws.Cells["S14"].CreateArrayFormula("= LET(wbsElement, CHOOSECOLS(ANCHORARRAY(L14),5),LET(" + - "wbsPositionDot1, SEARCH(\".\",wbsElement, 1)," + - "wbsPositionDot2,SEARCH(\".\", wbsElement, wbsPositionDot1+1)," + - "wbsPositionDot3, SEARCH(\".\", wbsElement, wbsPositionDot2+1)," + - "wbsPositionDot1* wbsPositionDot2*wbsPositionDot3))", true); - - //ws.Cells["S14"].CreateArrayFormula("LET" + - // "(" + - // "wbsElement," + - // "CHOOSECOLS(ANCHORARRAY(L14),5)," + - // "LET(" + - // "wbsPositionDot1, " + - // "IFERROR(SEARCH(\".\", wbsElement, 1),0)," + - // "wbsPositionDot2, " + - // "IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot1+1),0)," + - // "wbsPositionDot3, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot2+1),0)," + - // "wbsPositionDot1*wbsPositionDot2*wbsPositionDot3)" + - // ")" - // , true); - //ws.Cells["R14"].Formula = "xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))"; - //ws.Cells["R14"].CreateArrayFormula("xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))", true); - - ws.Cells["R14:R16"].Calculate(); - - //ws.Cells["R14"].Calculate(); - //ws.Cells["R15"].Calculate(); - - //var myValue = ws.Cells["R14"].Value; - //var secondValue = ws.Cells["R15"].Value; - //var firstVal = - //var secondVal - //ws.Cells["R14:R16"].Calculate(); - var myValues = ws.Cells["R14:R16"].Value; - - Assert.AreEqual("RDPMS.CH10.001", ws.Cells["R14"].Value); - Assert.AreEqual("R.100.200.300", ws.Cells["R15"].Value); - Assert.AreEqual("R.200.300.400", ws.Cells["R16"].Value); - - ws.Cells["S14:S16"].Calculate(); + //ws.Cells["S14"].CreateArrayFormula("= LET(wbsElement, CHOOSECOLS(ANCHORARRAY(L14),5),LET(" + + // "wbsPositionDot1, SEARCH(\".\",wbsElement, 1)," + + // "wbsPositionDot2,SEARCH(\".\", wbsElement, wbsPositionDot1+1)," + + // "wbsPositionDot3, SEARCH(\".\", wbsElement, wbsPositionDot2+1)," + + // "wbsPositionDot1* wbsPositionDot2*wbsPoitionDot3))", true); + ws.Cells["S14"].CreateArrayFormula("LET(wbsElement,CHOOSECOLS(ANCHORARRAY(L14),5),LET(" + + "wbsPositionDot1, IFERROR(SEARCH(\".\", wbsElement, 1),0)," + + "wbsPositionDot2, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot1+1),0)," + + "wbsPositionDot3, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot2+1),0)," + + "wbsPositionDot1*wbsPositionDot2*wbsPositionDot3))", true); + + //var chain = p.Workbook.FormulaParserManager.GetCalculationChain(ws.Cells["S14"]); + //var result = p.Workbook.FormulaParserManager.Parse(ws.Cells["S14"].Formula); + + //ws.Cells["S14"].UseImplicitItersection = true; + //ws.Cells["S14"].CreateArrayFormula("LET" + + // "(" + + // "wbsElement," + + // "CHOOSECOLS(ANCHORARRAY(L14),5)," + + // "LET(" + + // "wbsPositionDot1, " + + // "IFERROR(SEARCH(\".\", wbsElement, 1),0)," + + // "wbsPositionDot2, " + + // "IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot1+1),0)," + + // "wbsPositionDot3, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot2+1),0)," + + // "wbsPositionDot1*wbsPositionDot2*wbsPositionDot3)" + + // ")" + // , true); + ////ws.Cells["R14"].Formula = "xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))"; + ////ws.Cells["R14"].CreateArrayFormula("xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))", true); + + //ws.Cells["R14:R16"].Calculate(); + + ////ws.Cells["R14"].Calculate(); + ////ws.Cells["R15"].Calculate(); + + ////var myValue = ws.Cells["R14"].Value; + ////var secondValue = ws.Cells["R15"].Value; + ////var firstVal = + ////var secondVal + ////ws.Cells["R14:R16"].Calculate(); + //var myValues = ws.Cells["R14:R16"].Value; + + //Assert.AreEqual("RDPMS.CH10.001", ws.Cells["R14"].Value); + //Assert.AreEqual("R.100.200.300", ws.Cells["R15"].Value); + //Assert.AreEqual("R.200.300.400", ws.Cells["R16"].Value); + var options = new ExcelCalculationOption() + { + CacheExpressions = true, + EnableUnicodeAwareStringOperations = true + }; + ws.Cells["S14:S16"].Calculate(options); var value = ws.Cells["S14:S16"].Value; - ws.Cells["Q15"].Calculate(); + //ws.Cells["Q15"].Calculate(); p.Workbook.FormulaParserManager.DetachLogger(); - var cellValues2 = ws.Cells["Q15"].Value; + //var cellValues2 = ws.Cells["Q15"].Value; - //ws.Calculate(); + ////ws.Calculate(); - //var cellValues = ws.Cells["A1:A3"].Value; + ////var cellValues = ws.Cells["A1:A3"].Value; - //var cellValues2 = ws.Cells["Q15"].Value; + ////var cellValues2 = ws.Cells["Q15"].Value; - List extractedValues = new List(); + //List extractedValues = new List(); - foreach(var cell in ws.Cells["A1:A3"]) - { - extractedValues.Add(cell.GetValue()); - } + //foreach(var cell in ws.Cells["A1:A3"]) + //{ + // extractedValues.Add(cell.GetValue()); + //} //p.Workbook.FullCalcOnLoad = false; p.Workbook.CalcMode = ExcelCalcMode.Manual; From d1875266d4640d85140f4e5ea17180a5068b8145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ossian=20Edstr=C3=B6m?= Date: Wed, 8 Jul 2026 15:01:40 +0200 Subject: [PATCH 3/3] Simplified test --- .../Issues/FormulaCalculationIssues.cs | 104 +----------------- 1 file changed, 5 insertions(+), 99 deletions(-) diff --git a/src/EPPlusTest/Issues/FormulaCalculationIssues.cs b/src/EPPlusTest/Issues/FormulaCalculationIssues.cs index e8b9ea1d9..7523c413d 100644 --- a/src/EPPlusTest/Issues/FormulaCalculationIssues.cs +++ b/src/EPPlusTest/Issues/FormulaCalculationIssues.cs @@ -1710,107 +1710,13 @@ public void s1063() { var ws = p.Workbook.Worksheets[0]; - //ws.Calculate(); - - // Output from the logger will be written to the following file - var logfile = new FileInfo(@"c:\temp\logfiles1063LET.txt"); - - ws.Cells["T14"].CreateArrayFormula("CHOOSECOLS(ANCHORARRAY(L14),5)", true); - - ws.Cells["T14"].Calculate(); - - var testInitial = ws.Cells["T14:T16"].Value; - - ws.Cells["U14"].CreateArrayFormula("SEARCH(\".\", CHOOSECOLS(ANCHORARRAY(L14),5), 1)", true); - - ws.Cells["U14"].Calculate(); - - var test = ws.Cells["U14:U16"].Value; - - p.Workbook.FormulaParserManager.AttachLogger(logfile); - - ws.Cells["V14"].CreateArrayFormula("SEARCH(\".\",ANCHORARRAY(T14),(ANCHORARRAY(U14)+1))",true); - //ws.Cells["V14"].UseImplicitItersection = false; - ws.Cells["V14"].Calculate(); - - var resultsTheory = ws.Cells["V14:V16"].Value; - - //ws.Cells["R14"].CreateArrayFormula("LET(wbsElement,CHOOSECOLS(ANCHORARRAY(L14),5),wbsElement)", true); - - //START HERE: This works but adding IfError fucks it up - //ws.Cells["S14"].CreateArrayFormula("= LET(wbsElement, CHOOSECOLS(ANCHORARRAY(L14),5),LET(" + - // "wbsPositionDot1, SEARCH(\".\",wbsElement, 1)," + - // "wbsPositionDot2,SEARCH(\".\", wbsElement, wbsPositionDot1+1)," + - // "wbsPositionDot3, SEARCH(\".\", wbsElement, wbsPositionDot2+1)," + - // "wbsPositionDot1* wbsPositionDot2*wbsPoitionDot3))", true); - ws.Cells["S14"].CreateArrayFormula("LET(wbsElement,CHOOSECOLS(ANCHORARRAY(L14),5),LET(" + - "wbsPositionDot1, IFERROR(SEARCH(\".\", wbsElement, 1),0)," + - "wbsPositionDot2, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot1+1),0)," + - "wbsPositionDot3, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot2+1),0)," + - "wbsPositionDot1*wbsPositionDot2*wbsPositionDot3))", true); - - //var chain = p.Workbook.FormulaParserManager.GetCalculationChain(ws.Cells["S14"]); - //var result = p.Workbook.FormulaParserManager.Parse(ws.Cells["S14"].Formula); - - //ws.Cells["S14"].UseImplicitItersection = true; - //ws.Cells["S14"].CreateArrayFormula("LET" + - // "(" + - // "wbsElement," + - // "CHOOSECOLS(ANCHORARRAY(L14),5)," + - // "LET(" + - // "wbsPositionDot1, " + - // "IFERROR(SEARCH(\".\", wbsElement, 1),0)," + - // "wbsPositionDot2, " + - // "IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot1+1),0)," + - // "wbsPositionDot3, IFERROR(SEARCH(\".\", wbsElement, wbsPositionDot2+1),0)," + - // "wbsPositionDot1*wbsPositionDot2*wbsPositionDot3)" + - // ")" - // , true); - ////ws.Cells["R14"].Formula = "xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))"; - ////ws.Cells["R14"].CreateArrayFormula("xlfn.LET(_xlpm.wbsElement,_xlfn.CHOOSECOLS(_xlfn.ANCHORARRAY(L14),5),_xlfn.LET( _xlpm.wbsPositionDot1, IFERROR(SEARCH(\".\", _xlpm.wbsElement, 1),0), _xlpm.wbsPositionDot2, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot1+1),0), _xlpm.wbsPositionDot3, IFERROR(SEARCH(\".\", _xlpm.wbsElement, _xlpm.wbsPositionDot2+1),0), _xlpm.wbsPositionDot1*_xlpm.wbsPositionDot2*_xlpm.wbsPositionDot3))", true); - - //ws.Cells["R14:R16"].Calculate(); - - ////ws.Cells["R14"].Calculate(); - ////ws.Cells["R15"].Calculate(); - - ////var myValue = ws.Cells["R14"].Value; - ////var secondValue = ws.Cells["R15"].Value; - ////var firstVal = - ////var secondVal - ////ws.Cells["R14:R16"].Calculate(); - //var myValues = ws.Cells["R14:R16"].Value; - - //Assert.AreEqual("RDPMS.CH10.001", ws.Cells["R14"].Value); - //Assert.AreEqual("R.100.200.300", ws.Cells["R15"].Value); - //Assert.AreEqual("R.200.300.400", ws.Cells["R16"].Value); - var options = new ExcelCalculationOption() - { - CacheExpressions = true, - EnableUnicodeAwareStringOperations = true - }; - ws.Cells["S14:S16"].Calculate(options); - - var value = ws.Cells["S14:S16"].Value; - - //ws.Cells["Q15"].Calculate(); - p.Workbook.FormulaParserManager.DetachLogger(); - //var cellValues2 = ws.Cells["Q15"].Value; - - ////ws.Calculate(); - - ////var cellValues = ws.Cells["A1:A3"].Value; - - ////var cellValues2 = ws.Cells["Q15"].Value; - - //List extractedValues = new List(); + ws.ClearFormulaValues(); + ws.Calculate(); - //foreach(var cell in ws.Cells["A1:A3"]) - //{ - // extractedValues.Add(cell.GetValue()); - //} + Assert.AreEqual(ws.Cells["A1"].Value.ToString(), "R&D Project"); + Assert.AreEqual(ws.Cells["A2"].Value.ToString(), "Labwerks"); + Assert.AreEqual(ws.Cells["A3"].Value.ToString(), "R&D Single Order"); - //p.Workbook.FullCalcOnLoad = false; p.Workbook.CalcMode = ExcelCalcMode.Manual; SaveWorkbook("s1063-saved.xlsx", p);