What is Mail Merge and how do it in C# and VB .Net?
(Generate documents populated by data and based on a Word template)
Mail Merge is the feature which allows you to easily generate a bunch of documents based on a template.
By way of example «what is Mail Merge»:
Let us say, we need to create an app which generates hundreds of identical medical certificates in PDF format.
Create an each PDF document programmatically in a cycle and insert personal data (First Name, Las Name, SSN, Date of Birth ...) from DB or a collection.
Actually, it's not so easy programmatically create document with a nice desing. And with future design changes, you may feel the difficulties to maintain this application.
Way with Mail Merge:
- Create a well-designed Word-template (*.doct) in MS Word with fields: First Name, Las Name, SSN, Date of Birth.
- Set the data source (DB) and link the fields ("FirstName = firtsname", ...).
- Execute the MailMerge method and you will get the populated PDF document based on the Template.
To help you feel at home working with Mail Merge, we prepared several C# apps:
- Creating envelopes for Simpson's family based on a one Template.
- Car rental contract - Simple WinForms App.