Execute Simple Mail Merge

In order to prepare your template to perform a simple mail merge (without regions, similar to the classic mail merge available in Microsoft Word) you should just insert one or more merge fields in the places you want to be populated with data from the data source.

 // Open an existing document.
            Document doc = new Document("Merge Field.doc");

            // Fill the fields in the document with user data.
            doc.MailMerge.Execute(
                new string[] { "Name", "City"},
                new object[] { "Zeeshan", "Islamabad" });

            // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser.
            doc.Save("MailMerge.ExecuteArray Out.doc");
        

Download

Last edited Mar 3, 2014 at 5:17 AM by asposemarketplace, version 2