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

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM