Last post Dec 03, 2013 09:16 AM by gonzalomendez
Apr 14, 2013 11:16 PM|vikb|LINK
I have a template letter in word.. I need to create a mail merge from a SQL database.. and then return the generated letters as one document to the user...
I am using MVC 4
any recomedations? any sample code? best practices?
Thanks in advance
Apr 15, 2013 11:16 AM|thirumaran007|LINK
did you tried this ?
Apr 15, 2013 08:43 PM|vikb|LINK
Just wondering thought it seems like word will need to be installed on the server... seems like a big overhead...
whats the best practice is trying to achieve this? I just need to be able to update the template easily.. so it doesnt need to be word... but anything.... and to interface that with some c# code to create the mail merges...
Apr 25, 2013 07:58 AM|Jure.Les|LINK
Using MS Word automation (via Office COM) for document generation is strongly discouraged (even by MS itself) especially on server side (ASP.NET app). There are several alternatives such as:
- Your custom solution built on top of Open XML SDK
- 3rd party component. The vast majority are commercial.
You will very easily accomplish the task with
this toolkit (COM free) but you should know it is a commercial one. All you need is to create a template (in MS Word with a special Add-In that will help you bind all the placeholders on the template) and obtain the data in the form of a collection of letters
and feed this to the toolkits engine to populate the template. I would suggest you to download the trial and play with the demo application which installs with the product and you will quickly get the idea...
Apr 29, 2013 12:57 AM|vikb|LINK
wow thanks for that... I might have a look at the open XML SDK....
any other 3rd parties you can recomend.. the one you have shown looks good... but quite pricey....
May 01, 2013 11:18 AM|Jure.Les|LINK
The only free similar tool that I know is
FlexDoc but I wouldn't use it because it relies on a feature (XmlNode control) that has been removed from MS Word 2010.
Then there is Windword reports which (as far as I know) is the only .NET library that features its own Add-In for MS Word similar to Docentric Toolkit.
The following are components that feature document object model approach to document generation but also have some simple form of mail-merge functionalities, mostly very simple ones like placeholders and repeating sections:
- Office Writer
- Syncfusion DocIO
Yes, you can go for your own solution made on top of Open XML SDK, but note that this is a very tedious task that demands knowing at least some Open XML standard basics and can quickly end in a non-robust piece of software. In my oppinion it not nearly pays
off in terms of money if there is a 3rd party component that can solve your problem.
Dec 03, 2013 09:16 AM|gonzalomendez|LINK
Have you tryed NTemplates? Not exactly for Word documents but if you don't mind using RTF, it might be the solution. Download full source code and examples for free from ntemplates.codeplex.com.
Hope this helps!