未安装相应Office版本如何获取特定Excel对象库

发布于 2024-08-31 03:42:42 字数 374 浏览 3 评论 0原文

我正在开发一个 Excel 自动化应用程序,可以读取和写入 Excel 电子表格。我的计算机上安装了 Office 2007。因此,我可以参考 Excel 12.0 对象库和 Excel 5.0 对象库。我不想使用 Excel 5.0,因为它确实很旧并且文档很少。因此我引用的是 Excel 12.0。

但是目标计算机安装了 Office 2003,因此只有 Excel 11.0。因此,当我编译程序时,它会在目标计算机上崩溃,因为引用的库不同。

我想知道有没有办法可以在不安装 Office 03 的情况下获取 Excel 11.0?我尝试从 msdn 和 microsoft 支持页面查找答案,但找不到任何内容?这很奇怪,因为将来也可能发生这种情况,即开发人员拥有比客户端更新版本的 Office?

I am developing a Excel automation app that read and write to Excel spreadsheet. I have Office 2007 installed on my machine. I therefore can reference the Excel 12.0 Object Library and the Excel 5.0 Object Library. I don't want to use Excel 5.0 because it's really quite old and poorly documented. Therefore I'm referencing Excel 12.0.

However the target machine have Office 2003 installed and therefore only have Excel 11.0. So when I compile my program it crashes on the target machine since the referenced library are different.

I was wondering is there a way I could obtain the Excel 11.0 without installing Office 03? I tried to find answers from msdn and microsoft support page but couldn't find anything? This is quite strange since it could also happen in the future where developers has newer editions of Office than clients?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

盛夏已如深秋| 2024-09-07 03:42:42

查看我的开源项目 MS Office Wrapper for .NET
Office 应用程序对象的实例是通过“CreateObject”方法动态创建的,然后使用后期绑定功能,因此您不需要对任何版本的 MS Office 库进行任何“强引用”。

您可以使用 C#、VB.NET、J# 等...

源代码也可用。

Look at my open source project MS Office Wrapper for .NET.
The instance of Office application object is created dynamically via "CreateObject" method and then is used late-binding ability, so you don't need any "strong reference" to any version of MS Office libraries.

You can use C#, VB.NET, J#, etc...

The source code is available too.

半葬歌 2024-09-07 03:42:42

其实你没必要战斗得那么坚强。只需包含到最新的 Office PIA (2007) 分发包中即可。它向后兼容 Office 2003。

请阅读 Excel 产品团队博客< /a> 和有关兼容性的详细答案

我们将 2007 PIA 纳入发行版,并且在使用以前的 (2003) 版本的 Excel 时没有任何问题。

这里提到的 MS Office Wrapper for .NET 是非常好的替代方案。

You don't really have to fight so strong. Just include into distribution package latest Office PIA (2007). It backward compatible with Office 2003.

Please read Excel product team blog and detailed answer about compatibility here.

We include 2007 PIA into distribution and have no any issues with working previous (2003) version of Excel.

MS Office Wrapper for .NET mention here is very nice alternative.

单调的奢华 2024-09-07 03:42:42

我对 SpreadsheetGear 非常满意。该组件允许您读取和写入 Excel 文件。我用它来报告,客户端机器只有 Excel Viewer(免费)来读取文件并打印它们。

我使用 Excel Viewer 2003,因为 2007 版本有一个打印错误(打印时提示您打开文件对话框)

I am pretty happy with SpreadsheetGear. This component allows you to read and write excel files. I am using it for reporting, client machine has only Excel Viewer (which is free) to read files and print them.

I am using Excel Viewer 2003 because 2007 version has a printing bug (on print it's promt you open file dialog)

冷夜 2024-09-07 03:42:42

您需要下载并安装 适用于您需要的 Office 版本的 Office 互操作程序集

对于 Office 2003,请从此处下载
对于 Office 2007,请从此处下载

You'll need to download and install the Office Interop Assemblies for the version(s) of Office you need.

For Office 2003, download from here
For Office 2007, download from here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文