maven依赖
<dependency>
<groupId>net.sf.jxls</groupId>
<artifactId>jxls-core</artifactId>
<version>1.0.6</version>
</dependency>
Excel格式
写一个main方法
public static void main(String[] args) throws Exception {
User user = new User();
Pojo pojo = new Pojo();
pojo.setId(1);
pojo.setPassword("123456");
Pojo pojo2 = new Pojo();
pojo2.setId(2);
pojo2.setPassword("1234567");
List<Pojo> pojoList = new ArrayList<>();
pojoList.add(pojo);
pojoList.add(pojo2);
user.setUsername("小明");
user.setList(pojoList);
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new F