I am trying to load up Mail Merge recipients and their records dynamically in C# using MailMerge interface. I managed to load up the header using MailMerge.CreateDataSource method giving a comma separated string in HeaderRecord. These fields show up when I run Word but the problem is that I can't find any method to populate it's records as well. Currently how I am doing it is making the following csv file and using MailMerge.OpenDataSource
method to load this datasource:
Name, Age, Gender, Country, Email
Dummy1, Male, 20, England, dummy1@gmail.com
Dummy2, Male, 21, Spain, dummy2@gmail.com
Dummy3, Male, 22, France, dummy3@gmail.com
My requirement is to load the data without creating any external file, I'm looking for something which would do something similar to:
MailMerge.AddRecord("Dummy1, Male, 20, England, dummy1@gmail.com")