Interop Excel method LinEst failing with DISP_E_TYPEMISMATCH

前端 未结 1 524
说谎
说谎 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 x = new List { 1, 2, 3, 4 };
        List y = new List { 11, 12, 45, 42 };
        //object o = wsf.LinEst(x, y, true, true);
        object o = wsf.LinEst(y.ToArray(), x.ToArray(), false, true);
    

    0 讨论(0)
提交回复
热议问题