How to export Data table to Excel file without using interop and 3rd party packages

0

I am trying to export Data table to Excel file without using interop and 3rd party packages but I'm getting error like below error:

System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
   at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
   at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
   at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Project.Dal.Migration.ExportToExcel(String clientID, String empID, String constr, String excelPath, String fileName) in Migration.cs:line 388
c#
excel
datatable
office-interop
asked on Stack Overflow Nov 30, 2018 by Guruprakash • edited Nov 30, 2018 by James Z

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0