verysu 设计模式 设计模式 响应式编程 百度开发平台 codeforces leetcode usfca

导航

导出文件

easyexcel 导出文件

实体类

@Data
@Accessors(chain = true)
public class RefDeptExcelDTO {
  @ExcelProperty({"一"})
  @ColumnWidth(20)
  private String dept1;

  @ExcelProperty({"二"})
  @ColumnWidth(20)
  private String dept2;

  @ExcelProperty({"三"})
  @ColumnWidth(20)
  private String dept3;

  @ExcelProperty({"四"})
  @ColumnWidth(20)
  private String dept4;

  @ExcelProperty({"五"})
  @ColumnWidth(20)
  private String dept5;

}

  导出代码

setResponseCommonParams(response, fileName);
ExcelWriter excelWriter  = EasyExcel.write(response.getOutputStream()).inMemory(true).build();
WriteSheet writeSheet =
        EasyExcel.writerSheet(i, sheetList.get(i).getSheetName())
                .head(sheetList.get(i).getHead())
                .build();
excelWriter.write(sheetList.get(i).getSourceList(), writeSheet);
excelWriter.finish();

  或者

EasyExcel.write(response.getOutputStream(), head).sheet(sheetName).doWrite(sourceList);

  

posted on 2022-04-08 17:56  泳之  阅读(90)  评论(0编辑  收藏  举报

我是谁? 回答错误