I got a simple POCO "Employee" class as below.
public class Employee
{
public string Name { get; set; }
public int Age { get; set; }
public double Salary { get; set; }
public string Address { get; set; }
}
I create an array of that class. I registered this assembly to excel using excel dna. When the below method "GetEmployeeAsync" is invoked from excel, I am getting error as "#VALUE!" in every excel cell. How can I get that displayed in ExcelDna? When I return that as an object[] instead of Poco type, it works. Is it a limitation with Excel-Dna? Is it possible to return .NET types to excel through excel-dna?
ExcelFunction(Description = ".NET function Return Employee Details")]
public static object GetEmployeeAsync(string name)
{
var empList= new List<Employee>()
{
new Employee {Name = name, Age = 30, Salary = 20.0, Address = "London"},
new Employee {Name = name, Age = 30, Salary = 20.0, Address = "London"},
new Employee {Name = name, Age = 30, Salary = 20.0, Address = "London"},
new Employee {Name = name, Age = 30, Salary = 20.0, Address = "London"},
new Employee {Name = name, Age = 30, Salary = 20.0, Address = "London"},
new Employee {Name = name, Age = 30, Salary = 20.0, Address = "London"},
new Employee {Name = name, Age = 30, Salary = 20.0, Address = "London"},
};
return empList;
}