开发者

Mail/Word Merge in .NET? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜