...
Code Block |
---|
public void GenerateDocument() { WordTemplate wt = new WordTemplate(); wt.Open(@"..\..\WordTemplateFiles\NestedMailMergeTemplate.docx"); //Retrieve the Data from the source, a csv file with a helper method DataTable dt = GetMailMergeData(@"..\..\WordData\NestedMailMergeData.csv"); // set dt as the datasource for the repeatblock and "MailMerge" as the bookmark. // this will cause wordwriter to bind each letter on a different page of the output file. wt.SetRepeatBlock(dt, "MailMerge"); wt.Process(); //Save the Document in the desired location wt.Save(@"..\..\WordOutputFiles\NestedMailMerge_output.docx"); } |
Downloads
Panel |
---|
Template: NestedMailMergeTemplate.docx Output: NestedMailMerge_output.docx |