【问题标题】:Microsoft office web Components not working with Visual Studio 2012Microsoft Office Web 组件不适用于 Visual Studio 2012
【发布时间】:2014-01-15 04:58:46
【问题描述】:

我正在使用 Visual Studio 2012 并创建一个 VB.Net Windows 窗体应用程序,而我正在尝试使用 Microsoft Office Web 组件将 Excel 工作表嵌入到表单中。

我已经安装了 Office web components 11。在选择 Microsoft office 电子表格 11.0 项目时显示以下错误

无法导入 ActiveX 控件。请确保已正确注册。

当我构建它时,它显示以下错误。

------ Rebuild All started: Project: WindowsApplication11, Configuration: Debug Any CPU ------
  COM Reference 'OWC11' is the interop assembly for ActiveX control 'AxOWC11' but was marked to be linked by the compiler with the /link flag. This COM reference will be treated as a reference and will not be linked.
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): warning MSB3284: Cannot get the file path for type library "7c0ffab0-cd84-11d0-949a-00a0c91110ed" version 1.0. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): error MSB3303: Could not resolve COM reference "0002e558-0000-0000-c000-000000000046" version 1.0. Object reference not set to an instance of an object.
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): warning MSB3284: Cannot get the file path for type library "7c0ffab0-cd84-11d0-949a-00a0c91110ed" version 1.0. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): error MSB3303: Could not resolve COM reference "0002e558-0000-0000-c000-000000000046" version 1.0. Object reference not set to an instance of an object.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

PFB 快照,同时将 Microsoft 电子表格 11.0 项拖放到表单中

即使我尝试过手动注册,PFB .. 但得到同样的错误!

请告诉我是什么问题以及如何解决?

【问题讨论】:

  • 错误消息清楚地表明问题是 COM/ActiveX 库未注册。您是否尝试过重新注册库?
  • @Dai : 请告诉我如何重新注册?
  • 此页面将帮助ss64.com/nt/regsvr32.html,但我不知道文件名是什么。还要确保您构建的是 32 位 EXE,而不是 AnyCPU 或 x64,除非您使用的是 64 位 Office 2010/2013 组件。
  • @Dai : 我只使用 64 位
  • 我也不知道要提供 DLL_Name !有什么建议吗?

标签: .net excel vb.net visual-studio-2012


【解决方案1】:

打开 CMD 并写入:

REGSVR32 YouDllName.dll

如果您收到错误消息:

Filename.dll is not an executable file and no registration helper is registered for this file type. 

使用这个命令:

cd \windows\syswow64
regsvr32 c:\YouDllName.dll path for the dll file.

更新: 该文件名为owc11.dll,其默认位置为

C:\Program Files\Common Files\Microsoft Shared\Web Components\11

或者,如果你有64-bit Windows:

C:\Program Files (x86)\Common Files\Microsoft Shared\Web Components\11

【讨论】:

  • YouDllName.dll 是什么?它在哪里?
  • 我的意思是你要注册的DLL文件名
  • 不知道visual studio的dll文件名是什么?
  • 我更新了我的评论,请检查一下。希望对您有所帮助。
  • 当我尝试手动注册时,出现错误。请参阅问题所附的最新快照
【解决方案2】:

我得到了微软团队的答复!就是这样……

Office Web Components 是一项已弃用的技术,不再是 正在积极开发中。因此,我们建议您迁移到 Excel OWC 提供的服务。这记录在下面的文章中

http://blogs.office.com/b/microsoft-excel/archive/2006/07/17/office-web-components-roadmap.aspx

【讨论】:

    【解决方案3】:

    请访问此地址。我无法理解他们的技术用语,但底线是 OWC 将不再与办公室一起运行。

    http://blogs.office.com/2006/07/17/office-web-components-roadmap/

    【讨论】:

      【解决方案4】:

      在某些特殊情况下,无法删除密钥 {91A74EB0-EFA0-482B-B43C-35CFC74B275F}。在这些情况下,请执行以下操作:

      1) 使用实用工具 RunAsSystem

      https://www.raymond.cc/blog/full-control-permission-to-delete-or-edit-restricted-windows-registry/

      2) 删除密钥 {91A74EB0-EFA0-482B-B43C-35CFC74B275F}

      3) 快乐:-)

      【讨论】:

      • 我没有要求删除密钥!!
      【解决方案5】:

      我遇到了同样的问题。 这是我的编码环境,如下所示: VB2008/ Win7 SP1/ IE10/ OWC11

      我在将 IE 从 8 升级到 10 时遇到了这个问题。

      我的解决方案是用管理员启动 VB。然后,再次添加 OWC11 组件。 右键单击工具箱上的鼠标以单击“选择项目”。接下来,进入COM页面,然后到原来放置OWC11.DLL的地方,重新添加。最后,问题将得到解决。 试试看。

      就我而言,OWC11.dll 位于 C:\Program Files (x86)\Common Files\Microsoft Shared\Web Components\11\owc11.dll

      【讨论】:

        【解决方案6】:

        好的,这是我的解决方案:

        将其添加到工具箱后,将其拖放到 Windows 窗体中...会出现错误..单击确定..

        重建您的项目(将复制 DLL)

        重新拖放组件,现在它可以工作了

        Check this out

        【讨论】:

        • 重建时 dll 将被复制到哪里?因为我已经尝试重建它并完成拖放。它没有用。
        • 仅在重建时,我得到了有问题的错误。请检查
        • 我告诉过你先拖放然后当你得到错误点击确定然后重建然后再次拖放
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-31
        • 2012-07-14
        • 1970-01-01
        • 1970-01-01
        • 2014-01-07
        • 1970-01-01
        相关资源
        最近更新 更多