Libraries to generate docx files (Open XML)

放肆的年华 提交于 2020-01-14 08:57:31

问题


We need to generate docx documents from an asp.net mvc site. The documents will vary a great deal, but they are pretty basic - the only thing out of the ordinary is the need to include tables. The c# code that generates the documents will need to create similar html/css as well. We don't have time to buy a commercial product for this.

Should we just read the spec and write some code to spit out the XML, or are there libraries available that would do the trick?

Edit: looks like Microsoft's Open XML library is an obvious choice, but does anyone have any experience with it? And can anyone point to some sample code that uses it?


回答1:


Try this... http://openxmlwriter.codeplex.com/

codeplex.com has a lot of other libraries too.

http://www.codeplex.com/site/search?query=openxml




回答2:


You can try https://github.com/open-xml-templating/docxtemplater

It makes it possible to create a template written in docx, that contains tags Hello {name} tha will be replaced.

You also have the possibility to create tables by looping over the table columns.



来源:https://stackoverflow.com/questions/5356025/libraries-to-generate-docx-files-open-xml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!