NPOI通用导出数据封装


特点:

1. 简单可以一行代码实现导出数据

2. 导出后的数据格式, 默认设置成国人习惯的格式,如日期为"yyyy年MM月dd日",手机号处理,小数保留2位精度等,这些格式也支持修改

3. 默认导出全部的字段, 也可以指定哪些字段不导出


使用例子:

Student student = new Student()
            {
                Name = "adf",
                Age = 20,
                AddTime = DateTime.Now,
                Today = DateTime.Now,
                ScoreRate = 87.123,
                Mobile = "18738183226",
                Remake = "1/2",
                OfWeek = DayOfWeek.Monday,
                NickNames = new List<string>() { "a", "b" }
            };

List students = new List();
students.Add(student);

// 导出数据 ,一行代码
new ExcelExportet()
.SaveToExcel(students);
//

 

相关