Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.E
来源:互联网 发布:程序员笔记本推荐 知乎 编辑:程序博客网 时间:2024/05/22 11:50
前段时间做了个将Txt中数据导出到Excel中的C#小应用程序,一直都运行很好的。今天突然有同事安装时,报如下错:
************** Exception Text **************
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: 不支持此接口 (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at TxtToExcelDemo.ExcelOperate.ExcelFileOperate.CreateExcelFile()
at TxtToExcelDemo.MainForm.btnLoadOut_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
经过排查,终于找到问题所在,原来是他的office安装不正确,重新安装office后,就可以解决问题了。
- Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.E
- Unable to cast COM object of type 'System.__ComObject' to class type 的解决办法
- Unable to cast COM object of type Microsoft.Office.Interop.Excel.ApplicationClass' ...
- Unable to cast COM object of type 'Word.ApplicationClass' to interface type 'Word._Application'"
- Unable to cast object of type 'System.Web.HttpApplication' to type 'Microsoft.Practices.CompositeWeb
- 解决方法:Unable to cast COM object of type 'Shell32.ShellClass' to interface 'Shell32.IShellDispatch5'
- unable to cast object of type 'Microsoft.SharePoint.SPsite' to type 'Microsoft.SharePoint.SPWeb'
- 【问题处理】Unable to cast object of type 'System.DBNull' to type 'System.String'.
- Interop type 'Microsoft.Office.Interop.Excel.ApplicationClass' cannot be embedded. Use th e applic
- Interface builder was unable to determine the type of xxx.xib
- Interface builder was unable to determine the type of xxx.xib
- iOS Interface builder was unable to determine the type of xxx.xib
- Interface builder was unable to determine the type of xxx.xib
- 严重:Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/Tomc
- 警告The argument of type String[] should explicitly be cast to Object[] for the invocation of the vara
- com.bstek.dorado.data.type.DefaultEntityDataType cannot be cast to com.bstek.dorado.data.type.Aggreg
- error - [com.sun.istack.SAXException2: unable to marshal type ".
- Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory
- 日期静态函数
- 关于LXR和glimpse配置实现方便阅读Linux源代码的过程
- 获得线程LWP
- 为什么导入android项目后 ,找不到类库
- java中ArrayList类
- Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.E
- Linux下安装MongoDB
- REST (REpresentational State Transfer,表述性状态转移)
- STP生成树协议—技术理解—Ciso设备配置总结
- MinHash
- Android应用如何监听自己是否被卸载
- HTML5 Web app开发工具Kendo UI Web教程:如何配置Kendo UI Calendar
- HorizontalScrollView +viewpager 自动显示全第一个与最后一个
- OCP-1Z0-052-V8.02-144题