Mail/Word Merge in .NET? [closed]
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 usi开发者_运维技巧ng 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?
See the docx library on codeplex.
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.
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).
精彩评论