如何判断系统上是否安装了 Office 主互操作程序集?

发布于 2024-09-02 17:30:46 字数 341 浏览 5 评论 0原文

我有一个程序当前通过 SpreadsheetML 文件输出 Excel。我使用流构建这些。这对于 Excel 来说空间效率非常低;这些文件可能是其他 Excel 二进制格式的 5 到 6 倍。

我想输出二进制 Excel 格式,例如 .xls 或 .xlsx,但我不希望程序的安装依赖于 Office。有些用户可能安装了它,有些用户可能没有安装。我该如何优雅地处理这件事?是否可以不将程序集作为依赖项,但基于启用二进制输出的用户仍然使用该程序集?

编辑:

在回顾一些旧问题时,我意识到我应该问如何检查 Office PIA 是否在系统上,如果可用则使用它们,但在不存在时优雅地处理情况并使用 SpreadsheetML。

I have a program that currently outputs Excel via SpreadsheetML files. I build these using streams. This is very space inefficient for Excel; the files can be 5 to 6 times as large as other Excel binary formats.

I would like to output a binary excel format such as .xls or .xlsx, but I don't want to have the installation of the program depend on Office. Some users might have it installed, some might not. How can I handle this gracefully? Is it possible to not have an assembly as a dependency but based on the user enabling binary output still use the assembly?

Edit:

In reviewing some old questions, I realized I should have been asking how to check if the Office PIA are on the system, use them if available, but gracefully handle the case when the yare not and use SpreadsheetML.

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

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

发布评论

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

评论(2

享受孤独 2024-09-09 17:30:46

如果您的基础编程平台是 Java,您可以使用 POI。如果是 .NET,您可以使用 NPOI (POI 的一个端口,正在积极开发中)。

这些库支持大多数功能。您无需安装Office,只需在程序中包含相应的库即可。

内存。

If your base programming platform is Java you can use POI. If it's .NET you can use NPOI (a port of POI, actively under development).

Most of the features are supported by these libraries. You need not install Office, just include the corresponding libraries in your program.

rAm.

黑寡妇 2024-09-09 17:30:46

您对二进制文件与 Excel 可以很好读取的其他格式有具体要求吗?输出带有 .xls 扩展名的 HTML 表的老技巧是否适用于您的应用程序? Excel 将正确呈现格式,我认为您甚至可以在表格单元格中嵌入公式,它们也会在 Excel 中呈现...

Do you have a specific requirement for a binary file vs. some other format that Excel will read nicely? Will the old trick of outputting an HTML table with .xls extension work for your application? Excel will render formatting properly and I think you can even embed formulas in the table cells and they will be rendered in Excel too...

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