I am having a problem executing an Excel Linest function.
My program is like
MyExcel.Application xl = new MyExcel.Application(); MyExcel.WorksheetFunction wsf = xl.WorksheetFunction; List<int> x = new List<int> { 1, 2, 3, 4 }; List<int> y = new List<int> { 11, 12, 45, 42 }; object o = wsf.LinEst(x, y, true, true);
And the namespace using MyExcel = Microsoft.Office.Interop.Excel;
The program compiles smoothly, but at runtime it throws an error
{System.Runtime.InteropServices.COMException (0x80020005): Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
This is actually the first time I use the Excel function. Therefore, I cannot continue. If someone has dealt with this situation and decided, please help me.
I am using C # 3.0.
source share