如何在 C# 中创建 Word 文档? [英] How can a Word document be created in C#?

查看:22
本文介绍了如何在 C# 中创建 Word 文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我想在其中生成 MS Word 格式的报告导出.该报告将包括图像/图表、表格和文本.做这个的最好方式是什么?第三方工具?你有什么体验?

I have a project where I would like to generate a report export in MS Word format. The report will include images/graphs, tables, and text. What is the best way to do this? Third party tools? What are your experiences?

推荐答案

答案将在一定程度上取决于应用程序是在服务器上运行还是在客户端计算机上运行.如果您在服务器上运行,那么您将想要使用一种基于 XML 的办公生成格式,因为当 在服务器上使用办公自动化.

The answer is going to depend slightly upon if the application is running on a server or if it is running on the client machine. If you are running on a server then you are going to want to use one of the XML based office generation formats as there are know issues when using Office Automation on a server.

但是,如果您在客户端计算机上工作,那么您可以选择 使用 Office 自动化 或使用 Office Open XML 格式(请参阅下面的链接),Microsoft Office 2000 及更高版本本身或通过服务包支持该格式.但是,这样做的一个缺点是您可能无法嵌入您希望显示的某些类型的图形或图像.

However, if you are working on the client machine then you have a choice of either using Office Automation or using the Office Open XML format (see links below), which is supported by Microsoft Office 2000 and up either natively or through service packs. One draw back to this though is that you might not be able to embed some kinds of graphs or images that you wish to show.

处理事情的最佳方式完全取决于您在开发上投入多少时间.如果你走办公自动化的路线,有很多很好的教程可以通过谷歌找到,学习起来相当简单.但是,Open Office XML 格式相当新,因此您可能会发现学习曲线要​​高一些.

The best way to go about things will all depend sightly upon how much time you have to invest in development. If you go the route of Office Automation there are quite a few good tutorials out there that can be found via Google and is fairly simple to learn. However, the Open Office XML format is fairly new so you might find the learning curve to be a bit higher.

Office Open XML Iinformation

Office Open XML Iinformation

这篇关于如何在 C# 中创建 Word 文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆