ExcelReader reader = ExcelUtil.getReader("D:\\test.xlsx");
// 第一种,Map
List<Map<String, Object>> maps = reader.readAll();
System.out.println("maps = " + maps);
// 第二种,实体类
List<User> userList = reader.readAll(User.class);
System.out.println("userList = " + userList);
ExcelWriter writer = ExcelUtil.getWriter(false);
// 设置别名
reader.addHeaderAlias("名字", "name");
reader.addHeaderAlias("年龄", "age");
// 第一种,Map
List<Map<String, Object>> mapList = new ArrayList<>();
Map map = new HashMap();
map.put("name", "Tom");
map.put("age", 25);
mapList.add(map);
writer.write(mapList, true);
// 第二种,实体类
List<User> userList = new ArrayList<>();
userList.add(new User("Tom", 25));
writer.write(userList, true);
writer.flush(new FileOutputStream("D:/users.xls"));