简体   繁体   English

来自HRESULT的异常:0x800A03EC

[英]Exception from HRESULT: 0x800A03EC

Any help is appreciated: 任何帮助表示赞赏:

I'm developing a C#.Net app in VS2010 that interacts with Excel. 我正在VS2010中开发一个与Excel交互的C#.Net应用程序。 The app works correctly on my local machine. 该应用程序在我的本地计算机上正常运行 Uploading to a remote Windows 2003 server however, breaks the app. 然而,上传到远程Windows 2003服务器会破坏应用程序。

Originally, I received the following message 最初,我收到以下消息

  • Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 由于以下错误,检索CLSID为{00024500-0000-0000-C000-000000000046}的组件的COM类工厂失败:80070005

After Googling the problem (which suggested a permissions problem) i tried this: 谷歌搜索问题(这表明权限问题)我试过这个:

Now I get this message on the same operation: 现在我在同一个操作上收到此消息:

  • Exception from HRESULT: 0x800A03EC 来自HRESULT的异常:0x800A03EC

Google searches seem to be suggesting that this is a version match error. Google搜索似乎暗示这是版本匹配错误。 However, both the local machine and the remote server use Excel 2007. 但是,本地计算机和远程服务器都使用Excel 2007。

Any suggestions would be very welcome. 任何建议都会非常受欢迎。 Thanks in advance. 提前致谢。

-Daniel -Daniel

If you are trying to send a datagridview to an Excel spreadsheet, remember that Excel cells start at Cell (1,1) but datagridview.rows and datagridview.columns are indexed at 0. So if you try to send the contents of datagridviewcell(0,0) to the Excel Cell (0,0), you'll get Exception from HRESULT: 0x800A03EC 如果您尝试将datagridview发送到Excel电子表格,请记住Excel单元格从Cell(1,1)开始,但datagridview.rows和datagridview.columns的索引为0.因此,如果您尝试发送datagridviewcell的内容(0 ,0)到Excel单元格(0,0),您将从HRESULT获得异常:0x800A03EC

I was googling around frantically for a good 15 minutes before slamming my palm into my forehead for that one. 我疯狂地搜索了大约15分钟,然后将我的手掌撞到了我的额头上。

Excel.Cells(0,0)=Datagridviewcellvalue // throws HRESULT: 0x800A03EC error 
Excel.Cells(1,1) = Datagridviewcellvalue //no error

Delete the temporary ASP.Net files from "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files" this folder, Please check after this. 从“C:\\ WINDOWS \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ Temporary ASP.NET Files”这个文件夹中删除临时ASP.Net文件,请在此之后检查。

After checking also its not working then restart System and check... There is a chance to occur this because of corrupted files. 检查后它还没有工作然后重新启动系统并检查...由于文件损坏,有可能发生这种情况。 So do a disc checking. 所以进行光盘检查。

Thank you 谢谢

Suggestions: 建议:

  1. Control Excel from one thread and use the "en_US" culture. 从一个线程控制Excel并使用“en_US”文化。 There are many properties triggering 0x800A03EC if a non english culture is used. 如果使用非英语文化,有许多属性会触发0x800A03EC。 Is per accident your windows 2003 using another system language, if yes then this is probably the issue. 是偶然的,您的Windows 2003使用其他系统语言,如果是,那么这可能是问题。 No need to reinstall windows! 无需重新安装Windows! Just specify the culture for the thread in your app. 只需在应用中指定线索的文化即可。
  2. Check the length of the strings set using ranges. 检查使用范围设置的字符串的长度。 There is a limitation to 911 chars. 911个字符有限制。 You can set them separately for the cells having bigger strings. 您可以为具有较大字符串的单元格单独设置它们。 It is tedious but I could not find any other way to solve this. 这很乏味但我找不到任何其他方法来解决这个问题。

I was able to resolve this problem by wholesale disabling of all add-ins, and restarting the app. 我能够通过批量禁用所有加载项并重新启动应用程序来解决此问题。 Then I re-enabled the useful ones, watching Excel behavior. 然后我重新启用有用的,看Excel行为。 YMMV 因人而异

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM