We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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");

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>