自动生成Office文档时,是否建议使用Interop? [英] Is using Interop the recommended method when auto-generating Office documents?
问题描述
如标题中所述,我需要从Web应用程序中进行一些C#编码,这将自动生成Word文档.到目前为止,已针对Office 2007及更高版本的用户.
As stated in the title, I need to do some C# coding from a Web Application that will auto-generate a Word document. So far, targeted towards Office 2007 and above users.
我的问题是,是否建议使用Interop库来做到这一点?在不同版本之间使用它是否没有问题(例如2007-> 2010-> 2013)?它的优点和缺点是什么?最后,还有更好的选择吗?
My question would be, is using the Interop library the recommended way of doing this? Isn't there some issues with using it between different versions (e.g. 2007 -> 2010 -> 2013)? What are its advantages and disadvantages? And finally, are there any better alternatives?
推荐答案
相反,微软的建议绝不使用它:
Microsoft当前不建议并且不支持从任何无人参与的非交互客户端应用程序或组件(包括ASP,ASP.NET,DCOM和NT Services)自动化Microsoft Office应用程序,因为Office可能表现出不稳定在这种环境中运行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.
托管代码中提供了各种库(OpenXML SDK,Aspose Words等)
There are various libraries available in managed code (OpenXML SDK, Aspose Words etc.)
这篇关于自动生成Office文档时,是否建议使用Interop?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!