//--- A 2-D jagged array of values
string[][] ValuesArr = new string[][] {
new string[] {"Boston", "MA"},
new string[] {"Miami", "FL"},
new string[] {"Merchantville", "NJ"}
};
//--- Names array, elements correspond to merge field names
string[] NamesArr = {"City", "State"};
WordTemplate wt = new WordTemplate();
wt.Open("template.doc");
//--- Set the repeat block defined by the bookmark "Block"
//--- The data source is the 2-D rectangular ValuesArr array
wt.SetRepeatBlock(ValuesArr, NamesArr, "Block");
wt.Process();
wt.Save("out.doc");
|