1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Data;
6
7 using NPOIHelperTool;
8 using Bll;
9 namespace ConsoleApplication1
10 {
11 class Program
12 {
13 static void Main(string[] args)
14 {
15 DataTable data = new DataTable();
16 for (int i = 0; i < 5; ++i)
17 {
18 data.Columns.Add("Columns_" + i.ToString(), typeof(string));
19 }
20
21 for (int i = 0; i < 10; ++i)
22 {
23 DataRow row = data.NewRow();
24 row["Columns_0"] = "item0_" + i.ToString();
25 row["Columns_1"] = "item1_" + i.ToString();
26 row["Columns_2"] = "item2_" + i.ToString();
27 row["Columns_3"] = "item3_" + i.ToString();
28 row["Columns_4"] = "item4_" + i.ToString();
29 data.Rows.Add(row);
30 }
31
32 ExcelHelper h = new ExcelHelper();
33 DataTable de = h.ExcelToDataTable(@"E:\Myuser.xls", "Sheet1", true);
34 int c = h.DataTableToExcel(data, @"E:\Test.xls", "sheet1", true);
35 IList<student> a = TypeUtil.ToList<student>(de);
36 }
37
38 }
39 class student
40 {
41 public string Id { get; set; }
42 public string Name { get; set; }
43 public string nc { get; set; }
44 }
45 }