具有 DCOM 对象的 Microsoft Office 版本

Microsoft Office version to have DCOM Object

我正在尝试处理办公室 COM 对象。 但是安装Office后,在DCOMCNFG.exe中找不到COM字对象。 花了一些时间搜索正确版本的 Office 后,我读到 DCOM 对象仅适用于 Windows Server 2008 的企业版:

我正在开发 Windows Server 2012,所以我需要购买企业版吗?

您需要记住,MS 不建议在服务器端自动化 Office 应用程序,他们是这样说的:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

Considerations for server-side Automation of Office 文章中阅读更多相关信息。

作为一种可能的解决方法,如果您只处理打开的 XML 文档,您可以考虑使用 Open XML SDK,请参阅 Welcome to the Open XML SDK 2.5 for Office 了解介绍。另一种选择是为服务器端执行而设计的第三方组件。

我找到了解决问题的方法。 不是版本问题,是安装问题。 首先,我尝试使用 Office 的 ISO,但我没有 COM 对象。 但是通过使用您可以在线下载的可执行文件,我最终得到了我的 DCOM 对象。

服务器:Windows服务器 2012 办公版本:Office 2016