public void exportList( HttpServletResponse response) {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
//组装表头
List<List<String>> headList = Lists.newLinkedList();
headList.add(Collections.singletonList("标题1"));
headList.add(Collections.singletonList("标题2"));
headList.add(Collections.singletonList("标题3"));
//内容
List<List<String>> dataList = Lists.newLinkedList();
dataList.add(Collections.singletonList("内容1"));
dataList.add(Collections.singletonList("内容2"));
dataList.add(Collections.singletonList("内容3"));
//标题行 与 内容一一对应
EasyExcel.write(response.getOutputStream())
.head(headList)
.autoCloseStream(Boolean.TRUE)
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) //自动列宽
.sheet("sheet1")
.doWrite(dataList);
)