Hi,Excel Function is called multiple times When i calling a method asynchronously using ExcelAsyncUtil.Run() method from my Excel Function. If i removed the ExcelAsyncUtil.Run() Async method call, the Excel Function is calling Only one Time.Please find the below code snippets.[ExcelFunction(Name = "GetEmployeeList", Description = "Returns an array of fields",Category = "IT", HelpTopic = "help.chm!1000",IsMacroType = true)]
public static object[,] UdfMetaDataFunction
([ExcelArgument(AllowReference = false, Name = "Column_name", Description = "is an array or range of cells")]
object columnName,[ExcelArgument(Name = "Hide_additional_info", Description = "is a logical value to hide Metadata about the fields. TRUE hides Metadata; FALSE or omitted does not hide Metadata")] bool hideAdditionalInfo)
{
object[,] array = new object[1, 1];
array[0, 0] = "Loading";
// If I Removed the ExcelAsyncUtil.Run() method, then Excel function is calling one time only.
var result = ExcelAsyncUtil.Run("GetFunctionMetaData", new[] { columnName, hideAdditionalInfo }, () =>GetFunctionMetaData(columnName, hideAdditionalInfo));
if (result.Equals(ExcelError.ExcelErrorNA))
{
return FunctionHelper.DisplayErrorTemplateMessage(errorarray, "Loading...");
}
return array;
}
MethodImpl(MethodImplOptions.Synchronized)]
public static OutPutParser GetFunctionMetaData(object headers, bool additionalInfo)
{
//calling service to getData
}
Kindly help me on this issue.
Thanks,
Marik