Is there a way to generate excel report in c# using interop excel with version indepent?

  • Thread starter Thread starter KV Ramana
  • Start date Start date
K

KV Ramana

Guest
I am using Visual Studio 2019 and installed "Microsoft.Office.Interop.Excel V 15.0.4795.1000" using Nuget. When I am generating excel report it is working fine with "Microsoft Office 2013". But, getting error message with "Microsoft Office Home and Business 2019".

Error Message : Exception from HRESULT: 0x800A03EC Exception : System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC

I assume that Interop Excel V 15 is not supporting with office 2019.

I used below code to create excel application.

using ExApp = Microsoft.Office.Interop.Excel;
ExApp.Application xlApp = new ExApp.Application();


Later, I also tried with below code thinking that it will work with multiple versions of excel.

Type ExcelType = Type.GetTypeFromProgID("Excel.Application");
dynamic xlApp = Activator.CreateInstance(ExcelType);


Is there a way we can generate excel report in c# on any version of excel (2007 to 2019)?

At least, I need solution for "Microsoft Office Home and Business 2019".

Continue reading...
 
Back
Top