c# Microsoft.Office.Interop.Excel.dll 报错System.Runtime.InteropServices.COMException (0x80070490)

---------------------------
System.Runtime.InteropServices.COMException (0x80070490): 检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-000000000046} 的组件失败,原因是出现以下错误: 80070490 找不到元素。 (异常来自 HRESULT:0x80070490)。

在 System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

在 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

在 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

在 System.Activator.CreateInstance(Type type, Boolean nonPublic)

在 System.Activator.CreateInstance(Type type)

在 mysql_operation.Form1.ToExcel2(Object para) 位置 tion\Form1.cs:行号 585
---------------------------
确定
---------------------------

* */

找到office正确的安装路径下的Microsoft.Office.Interop.Excel.dll,再引用

右键,以管理员身份运行

posted @ 2025-02-21 15:01  txwtech  阅读(269)  评论(0)    收藏  举报