public static void 追加表格行() { List <Student> students = new List <Student>() { new Student() { StuNo = "new4321", Age = 10, PhoneNum = "4321", Nationality = "Japan", Sex = 5 }, new Student() { StuNo = "new3214", Age = 20, PhoneNum = "1243", Nationality = "Japan", Sex = 4 }, new Student() { StuNo = "new2143", Age = 30, PhoneNum = "4321", Nationality = "Japan", Sex = 3 }, new Student() { StuNo = "new1432", Age = 10, PhoneNum = "1234", Nationality = "Japan", Sex = 2 }, }; DataTable td = ListDatatableMapper <Student> .ListToDataTable(students); XWPFDocument doc = null; using (FileStream fs = new FileStream(Demo.docPath, FileMode.Open, FileAccess.Read)) { doc = new XWPFDocument(fs); } XWPFTable t = doc.Tables[0]; WordHelper.AppendTable(t, td); using (FileStream fs = new FileStream(docToPath, FileMode.OpenOrCreate, FileAccess.Write)) { doc.Write(fs); } }