c# - c#生成word文档

标签 c# ms-word

我想用 C# 打开一个 Word 文档。我的意思是我想知道如何将 Word 文档嵌入到 C# 中。

我在网上找到了一些文章,我有一个问题。这是什么意思:打开 Word 应用程序,然后添加新的。如果我打开 Word,我看不到任何“添加新”是在 C# 中吗?我正在使用 Microsoft Visual Studio 2008。

All the methods used Word automation is derived either from Word.Application or Word.Document class.

Let's consider that we want to create a document using the Word Application, we might end up doing the following steps, Open Word Application. (Opening Word Application creates a new document by default, but in Automation, wee need to manually add a document)

Add a New document.
Edit the document.
Save it

文章顺便可以在这里找到:http://www.c-sharpcorner.com/UploadFile/amrish_deep/WordAutomation05102007223934PM/WordAutomation.aspx 我想明确指出这不是作业。

最佳答案

我倾向于发现 Open XML SDK 更适合用来创建 Word 文档,因为它不需要 Word 或 Excel 的实例。

Open XML Format SDK V1

Open XML Format SDK V2

版本 2 比版本 1 好得多。

关于c# - c#生成word文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/975235/

相关文章:

c# - 使用 BackGroundWorker 运行 WatiN 打开 IE 浏览器

excel - 在 Word 中返回表格之前的行

c# - 使形状最顶层

c# - 无法选择部分超链接范围

c# - 是否可以在存储过程的输出变量中使用 MERGE 语句的 $action?

c# - 通过转换器转换Json字符串与反序列化

c# - 将 MyClass 的列表显示到 DataGridView

c# - Socket.SendAsync 需要几秒钟才能完成

c# - 如何在 C# 字互操作中退格?

python - 使用 Python 退出 Word 文档时出现问题