00020970-0000-0000-C000-000000000046

00020970-0000-0000-C000-000000000046

 

System.InvalidCastException: 无法将类型为“Microsoft.Office.Interop.Word.ApplicationClass”的 COM 对象强制转换为接口类型“Microsoft.Office.Interop.Word._Application”。此操作失败的原因是对 IID 为“{00020970-0000-0000-C000-000000000046}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 不支持此接口 (异常来自 HRESULT:0x80004002 (E_NOINTERFACE))。

 

 

用C#写了一个操作Word的程序,本机测试没问题。拿到一个虚拟机下面的XP里面进行兼容性测试,发现有这个报错:

InvalidCastException: Unable to cast COM object of type ‘Microsoft.Office.Interop.Word.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Word._Application’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{00020970-0000-0000-C000-000000000046}’ failed due to the following error: 加载类型库/DLL 时出错
 
打开注册表:搜索:00020970-0000-0000-C000-000000000046

删除:下面两项8.3, 8.4。8.3是Office 2003, 8.4是Office 2007的。将8.4分支删除。程序运行正常!

以上方法还是不行。

最终决方法:

打开注册表搜索:{00020905-0000-0000-C000-000000000046}

删除 8.5

 

 

 

posted @ 2014-03-18 22:38  秋千,为谁荡  阅读(5111)  评论(0编辑  收藏  举报