auto-generating Office 文档时使用 Interop 是推荐的方法吗?

Is using Interop the recommended method when auto-generating Office documents?

如标题所述,我需要从将 auto-generate Word 文档的 Web 应用程序进行一些 C# 编码。到目前为止,针对Office 2007及以上用户。

我的问题是,使用 Interop 库是执行此操作的推荐方法吗?在不同版本之间使用它是否存在一些问题(例如 2007 -> 2010 -> 2013)?它的优点和缺点是什么?最后,还有更好的选择吗?

反之,Microsoft's advice是非常不用的:

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.

托管代码中有各种可用的库(OpenXML SDK、Aspose Words 等)

正如 Charles 提到的那样,Microsoft 不建议在服务器上(从任何无人值守的客户端)自动化 Office 应用程序。相反,我建议使用 Open XML SDK 来构建开放 XML 文件格式的 Office 文件。有关详细信息,请参阅 Welcome to the Open XML SDK 2.5 for Office