Reference:
Using System;
Using System.Collections.Generic;
Using System.Aspose.Words;
Using System.Windows.Forms;
To get the template path:
string " Path "; // Example: string = "E:\\word\\word1.doc" New Document ();
Put the data in the list<string>:
list<stringnew list<string>; Saved is the domain List<stringnew list<string>; The data to be inserted is saved
List1. ADD ("Name");
List2. ADD ("Messege"); Give the value Messege in the location of the domain name
Converts a list to a string array, using the Document.MailMerge.Excute (string1,string2) method; string1 is a domain, string2 is the data
string [] S1 = List1. Toarry (); string [] s2 = List2. Toarry ();d m. Mailmerge.excute (S1,S2); Assigning a value to a domain
Save to a folder create a new Newdoc.doc document:
string @" E:\word\newdoc.doc " New"Newdoc.doc"@ "e:\word "Word document (*.doc) |*.doc"; Sfd.show ();dd. Save (SFD. FileName);
C # reads the Word template and writes data to the specified domain as new word