We have a working application that runs using C# and Excel DNA to create functions that access a Java Webservice at a remote location (using RTD Server).
This application worked fine until we added optional parameters to one of our functions (I do not really know if the problem is related to optional parameters, we´ve made other changes until identify this problem).
I have something like the code bellow (unfortunately I had to change function and parameter names):
[ExcelFunction(Description = "XXXXX", Name = "FUNCTION", IsVolatile = true)]
public static object[,] Function(
[ExcelArgument(Description = "XXXX", Name = "paramA")]
string paramA,
[ExcelArgument(Description = "XXXX", Name = "paramB")]
string paramB,
[ExcelArgument(Description = "XXXX", Name = "paramC")]
string paramC,
[ExcelArgument(Description = "XXXX", Name = "optional")]
params string[] optional)
{
...
}
The first time I call this function it always works at the first time. But if I change anything in the parameter values, it stops working. What's happened? The string that calls the function simply turns to be a single string.
=FUNCTION("aaa";"bbb";"ccc")
at the cell value.
Anybody knows how to avoid this behavior? I´m not an experience office or even .Net developer so I could miss some relevant information about the problem. Feel free to ask any other information.
I was able to resolve the issue.
The problem was that I was formating the cell where the function was written to text. In that case, excel do not interpret the equals signal (=) as statement to a expression.
Removing this formatting (making it work with "general" formatting option) resolved the issue.