Interop Excel method LinEst failing with DISP_E_TYPEMISMATCH

前端 未结 1 525
说谎
说谎 2021-01-20 06:52

I am facing a problem while making Excel\'s LinEST function.

My program goes like

MyExcel.Application xl = new MyExcel.Application();
MyExcel.Workshe         


        
相关标签:
1条回答
  • 2021-01-20 07:26

    Convert the lists x and y to array :

        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);
        object o = wsf.LinEst(y.ToArray(), x.ToArray(), false, true);
    
    0 讨论(0)
提交回复
热议问题