FastExcel 能快速简单读取 excel 数据,将 Apache POI 进行了薄封装,基于注解,更加易于使用,此版本是第三个版本,本次更新修复了导出 excel 时出现的 BUG,以及升级 poi 版本 项目地址: 使用样例 1 2 3 4 5 6 7 8 9 10 | FastExcel fastExcel = new FastExcel("E:/data.xlsx");
fastExcel.setSheetName("活动信息数据");
List<MyTest> tests = fastExcel.parse(MyTest.class);
if(null != tests && !tests.isEmpty()) {
for(MyTest myTest : tests) {
LOG.debug("记录:{}", myTest.toString());
}
} else {
LOG.debug("没有结果");
}
|
映射类: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | public class MyTest {
@MapperCell(cellName = "名称")
private String name;
@MapperCell(cellName = "联系电话")
private String phone;
@MapperCell(cellName = "地址")
private String address;
@MapperCell(cellName = "一级分类ID")
private int type;
@MapperCell(cellName = "经度")
private double lat;
}
|
|