.NET有效的方式来生成WORD文档 - 服务器端服务器端、有效、方式、文档

2023-09-05 02:17:59 作者:入我心i】

.NET 4.0

我要寻找生成我们的服务器上的Word文档的最简单方法。

I am looking for the easiest way to generate a Word document on our server.

限制:

在服务器端 我不想在服务器上安装字 在数据源是XML

我试图生成DOCX用XSLT是快速和容易的,但我能找到的唯一方法来验证生成的文件是用Word和我得到的时候该文件是无效的唯一错误打开它,而错误打开文件。不是非常有用。

I tried to generate a DOCX with XSLT which is fast and easy but the only way I could find to validate the generated document is to open it with Word and the only error I get when the document is not valid is "Error while opening document". Not very useful.

任何想法?

谢谢, 亚历克斯

推荐答案

您有两个选项给你安装。

You have two options given your setup.

使用第三方库,类似的东西可以从 SyncFusion 使用XML路线,初始设置是不好玩的,但一旦你得到它的过程很简单。

第三,更粗暴的方式是编写一个HTML文件,并保存为名为.doc,但这会导致用户侧的警告与2007年和更高版本。

A third, much more crude way would be to write an HTML file and save as .doc, but that is going to cause warnings on the user side with 2007 and later.