1. Create a word template,Use MergeFeildBind dataString [] fieldNames = new String [] {"UserName", "Gender", "BirthDay", "Address "}; object [] fieldValues = new Object [] {"Zhang San", "male", "1988-09-02", "Xianyang, Shaanxi "};Create a template for cyclic data. Here, the cyclic data is similar to the for structure of the page and is not stuck in the form table.
«TableStart: UserList»
«UserName»
4. Use DataTable to provide data sources
Var datatable = GetDataTable ();
5. Bind a data template with a subloop
6. Use DataSet to provide data sourcesDataSet dataSet = new DataSet (); var userTable = GetUserDataTable (); var userScoreTable = GetUserScoreDataTable (); dataSet. tables. add (userTable); dataSet. tables. add (userScoreTable); dataSet. relations. add (new DataRelation ("ScoreListForUser", userTable. columns ["Id"], userScoreTable. columns ["UserId"]);
7. Use bookmarks on the template to insert the tag location
8. Insert the content of another document in the bookmarks