diff --git a/ExcelGenericUDF/ExcelGenericUDF.csproj b/ExcelGenericUDF/ExcelGenericUDF.csproj index 7291e9a..5e5c95b 100644 --- a/ExcelGenericUDF/ExcelGenericUDF.csproj +++ b/ExcelGenericUDF/ExcelGenericUDF.csproj @@ -30,13 +30,12 @@ 4 - - ..\packages\ExcelDna.Integration.0.33.9\lib\ExcelDna.Integration.dll + + ..\packages\ExcelDna.Integration.0.34.6\lib\ExcelDna.Integration.dll False - - ..\packages\ExcelDna.IntelliSense.1.0.0\lib\net40\ExcelDna.IntelliSense.dll - True + + ..\packages\ExcelDna.IntelliSense.1.1.0\lib\net40\ExcelDna.IntelliSense.dll ..\packages\UIAComWrapper.1.1.0.14\lib\net40\Interop.UIAutomationClient.dll @@ -70,14 +69,14 @@ + - - PreserveNewest - + + @@ -92,12 +91,14 @@ - xcopy "$(SolutionDir)\packages\ExcelDna.AddIn.0.33.9\tools\ExcelDna.xll" "$(TargetDir)ExcelGenericUDF-AddIn.xll*" /C /Y -xcopy "$(TargetDir)ExcelGenericUDF-AddIn.dna*" "$(TargetDir)ExcelGenericUDF-AddIn64.dna*" /C /Y -xcopy "$(SolutionDir)\packages\ExcelDna.AddIn.0.33.9\tools\ExcelDna64.xll" "$(TargetDir)ExcelGenericUDF-AddIn64.xll*" /C /Y -"$(SolutionDir)\packages\ExcelDna.AddIn.0.33.9\tools\ExcelDnaPack.exe" "$(TargetDir)ExcelGenericUDF-AddIn.dna" /Y -"$(SolutionDir)\packages\ExcelDna.AddIn.0.33.9\tools\ExcelDnaPack.exe" "$(TargetDir)ExcelGenericUDF-AddIn64.dna" /Y + + + + + + + + + + + + true + true + + + + 64 + + + + + + true + + + -packed + + + diff --git a/ExcelGenericUDF/Stringa/Concatenate.cs b/ExcelGenericUDF/Stringa/Concatenate.cs new file mode 100644 index 0000000..c1baae9 --- /dev/null +++ b/ExcelGenericUDF/Stringa/Concatenate.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using ExcelDna.Integration; +using ExcelDna.IntelliSense; + +namespace ExcelGenericUDF.Stringa +{ + public class Concatenate + { + [ExcelFunction(Name = Udf.nome + ".Stringa.ConcatenateMultiple", Description = "Concatenate adiacent cells")] + public static string ConcatenateMultiple( + [ExcelArgument(Name = "Concatenate Range", Description = "Select multiple cell to concanenate")] object[] Range, + [ExcelArgument(Name = "Separator", Description = "Separator String")] string Separator, + [ExcelArgument(Name = "Include Empty", Description = "if true show empty cells")] bool Empty) + { + try + { + string s = ""; + + foreach (var cell in Range) + { + if (cell is ExcelEmpty && Empty) + s += "" + Separator; + else if (cell is ExcelEmpty && Empty == false) { + + } + else + s += cell + Separator; + } + + return s.Substring(0, s.Length - Separator.Length); + } + catch (Exception e) + { + return e.ToString(); + } + + } + } +} diff --git a/ExcelGenericUDF/Stringa/Spazia.cs b/ExcelGenericUDF/Stringa/Spazia.cs index 523bbb2..a311320 100644 --- a/ExcelGenericUDF/Stringa/Spazia.cs +++ b/ExcelGenericUDF/Stringa/Spazia.cs @@ -7,13 +7,10 @@ using ExcelDna.Integration; using ExcelDna.IntelliSense; -using Excel = Microsoft.Office.Interop.Excel; - namespace ExcelGenericUDF.Stringa { - public class Spazia + public class Spazia { - [ExcelFunction(Name = Udf.nome + ".Stringa.Spazia", Description = "Data una stringa ed un pattern ne spazia il contenuto")] public static string spazia( [ExcelArgument(Name = "Stringa Iniziale", Description = "")] string nome, @@ -57,8 +54,6 @@ public static string spazia( { return $"Stringa non corrispondente al pattern: {e.ToString()}"; } - } - } } diff --git a/ExcelGenericUDF/Udf.cs b/ExcelGenericUDF/Udf.cs index 1ecd9b4..5bff1c1 100644 --- a/ExcelGenericUDF/Udf.cs +++ b/ExcelGenericUDF/Udf.cs @@ -20,12 +20,12 @@ public class Udf : IExcelAddIn { public void AutoOpen() { - IntelliSenseServer.Register(); + IntelliSenseServer.Install(); } public void AutoClose() { - + IntelliSenseServer.Uninstall(); } public const string nome = "Claudio"; diff --git a/ExcelGenericUDF/packages.config b/ExcelGenericUDF/packages.config index e4dcd2b..1278a23 100644 --- a/ExcelGenericUDF/packages.config +++ b/ExcelGenericUDF/packages.config @@ -1,9 +1,9 @@  - - - - + + + + \ No newline at end of file