0

How to do a mail merge in asp.net without installing word on the server?

any dlls or any components available?

Edits

The template document is already available. im not trying to create a word document. Just want to link the word document with the data.

Thanks

Vivek Chandraprakash
  • 1,165
  • 2
  • 21
  • 54

4 Answers4

2

Personally, I would just look at using the System.Net.Mail class and its templating abilities. There is a nice library here: https://github.com/lukencode/FluentEmail which you can pass templates into and send emails that way with the data you require inserted into it.

EDIT: noticed you didn't actually specify whether it was print mailmerge or email, apologies if it is a print mailmerge you are trying to create, but for mass emailing with customized data in it, templating is definitely the way to go.

anthonyvscode
  • 995
  • 8
  • 15
  • I'm not going to mail anything. There will be a form. The user will enter comments in teh form. thsi should be populated in a letter in word and let the user download the word document. – Vivek Chandraprakash Mar 25 '11 at 13:52
1

To accomplish the Word doc creation part of the question there is a previous thread about this: How can a Word document be created in C#?

To send the completed doc check out the System.Net.Mail namespace: http://msdn.microsoft.com/en-us/library/system.net.mail.aspx or if you can afford it I have had great experience with http://www.aspnetemail.com/.

Community
  • 1
  • 1
Paulczy
  • 641
  • 3
  • 4
  • True, not 100% same but the greatest difficultly is creating the Word document without Word. I'll edit my answer. – Paulczy Mar 24 '11 at 22:19
  • Hi Paul, Thanks for your answer. I'm not going to create word doc in .net. the doc will already be there. I'm just going to add data to the doc and let the user download it. – Vivek Chandraprakash Mar 25 '11 at 13:53
0

Another option is Docentric Toolkit. It is pure .NET and based on OpenXML without any dependency on MS Word, so it is a good fit for server side report generation.

Merging with data is done through placeholders, which get filled up with data at run time. Data can come from database or XML.

Templates are created in MS Word which needs Docentric Toolkit add-in installed (license is needed).

It is really easy to create templates and to merge them with data from .NET code.

0

We use Aspose.Words to perform mail merges from .net code. It's not cheap but once you get to grips with it it's very powerful.

Edit: I'm assuming you are looking to merge data from some sort of data store into a template word document which can be printed and distributed.

AndyM
  • 1,148
  • 1
  • 10
  • 19
  • HI Andy, Thanks for the answer. You are right about my requirment. But this one seems to be too expensive. Any economical ones? – Vivek Chandraprakash Mar 25 '11 at 14:02
  • Hi Vivek, I'm afraid aspose is the only one I'm aware of. I did find this question though http://stackoverflow.com/questions/435323/aspose-word-alternatives. Sorry I can't be of more help. – AndyM Mar 25 '11 at 14:35