Mail/Word Merge in .NET? [closed]

ぃ、小莉子 提交于 2019-12-10 11:47:12

问题


I would like to do a merge between a collection of information I have in memory and a word document. I have done this quite easily before using Aspose, but they want $2k for their tool...

I looked into using .NETs interop libraries but they require that I install Word on my server which I don't want to do.

Does anyone know of a good tool that is reasonably priced (or better yet, free) that will allow me to do what I am trying without abusing my server?


回答1:


See the docx library on codeplex.




回答2:


If you're using SQL Server, then you can use SQL Server reporting services. So instead of having a nice word document, you have RDL's instead: you create reports, and you can programmatically invoke your reports and generate PDFs on the fly.

I've used this approach to generate letters and invoices for customers, and it seemed to work well enough for production code.




回答3:


Have a look at content control data-binding.

Using this approach, you include your data as a Custom XML part (ie as XML of your own choosing), and that data is bound to particular locations in your docx using XPath expressions.

If you do things this way, Word helps you out: changes to the surface of the docx are reflected in your xml, and vice versa.

Requires Word 2007 or later (and sadly, the Windows version, not Word 2011 for the Mac).



来源:https://stackoverflow.com/questions/4853796/mail-word-merge-in-net

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