Mail Merge Twice

Using Aspose.Words I want to mailmerge once, then save the document, then later potentially mail merge again… so in first instance I want to only populate selected fields… then the second time populate the left over fields that were not populated the first time.

Hi Mark,

Thanks for your inquiry. In your case, I suggest you please do not pass the data source for mail merge fields which do not want to populate. Please check the following code example.

Please let us know if you have any more queries.

Document doc = new Document(MyDir + "MailMerge.ExecuteArray.doc");
// First mail merge
doc.MailMerge.Execute(
new string[] { "FullName", "Company" },
new object[] { "James Bond", "MI5 Headquarters" });
doc.Save(MyDir + "After First mail merge.docx");
doc = new Document(MyDir + "After First mail merge.docx");
// Second mail merge
doc.MailMerge.Execute(
new string[] { "Address", "Address2", "City" },
new object[] { "Milbank", "", "London"});
doc.Save(MyDir + "Out.docx");