From b25695528b117c97b60c799320fafc19cee44273 Mon Sep 17 00:00:00 2001 From: daichenjie Date: Wed, 8 May 2024 14:41:33 +0800 Subject: [PATCH 1/2] Implement CONCAT function --- main/SS/Formula/Atp/AnalysisToolPak.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/main/SS/Formula/Atp/AnalysisToolPak.cs b/main/SS/Formula/Atp/AnalysisToolPak.cs index 34b65d4c5..9ece2d849 100644 --- a/main/SS/Formula/Atp/AnalysisToolPak.cs +++ b/main/SS/Formula/Atp/AnalysisToolPak.cs @@ -87,6 +87,7 @@ private static Dictionary CreateFunctionsMap() r(m, "BIN2OCT", null); r(m, "COMPLEX", Complex.Instance); r(m, "CONVERT", null); + r(m, "CONCAT", TextFunction.CONCAT); r(m, "COUNTIFS", Countifs.instance); r(m, "COUPDAYBS", null); r(m, "COUPDAYS", null); From d5a4c53d9230e884dd9c5b08a98d07cdfccce03d Mon Sep 17 00:00:00 2001 From: daichenjie Date: Wed, 8 May 2024 14:42:42 +0800 Subject: [PATCH 2/2] Implement CONCAT function --- main/SS/Formula/Functions/Text/Concat.cs | 39 +++++++ .../SS/Formula/Functions/Text/TextFunction.cs | 1 + testcases/main/SS/Formula/Atp/TestConcat.cs | 104 ++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 main/SS/Formula/Functions/Text/Concat.cs create mode 100644 testcases/main/SS/Formula/Atp/TestConcat.cs diff --git a/main/SS/Formula/Functions/Text/Concat.cs b/main/SS/Formula/Functions/Text/Concat.cs new file mode 100644 index 000000000..723a9c943 --- /dev/null +++ b/main/SS/Formula/Functions/Text/Concat.cs @@ -0,0 +1,39 @@ +namespace NPOI.SS.Formula.Functions +{ + using System.Text; + using NPOI.SS.Formula.Eval; + + public class Concat : FreeRefFunction + { + public ValueEval Evaluate(ValueEval[] args, OperationEvaluationContext ec) + { + StringBuilder sb = new StringBuilder(); + foreach(ValueEval arg in args) + { + try + { + if(arg is AreaEval area) + { + for(int rn = 0; rn