本文共 1791 字,大约阅读时间需要 5 分钟。
com.alibaba easyexcel 1.1.2-beta5
public class PersonDto extends BaseRowModel{ /** id */ @ExcelProperty(index = 0 , value = "id") private String id; /** 姓名 **/ @ExcelProperty(index = 1 , value = "姓名") private String name; /** 生日 **/ @ExcelProperty(index = 2 , value = "生日" , format = "yyyy-MM-dd") private String birth;}
ExcelUtil.writeExcel(response,exportVoList,"导出文件名","sheet1", ExcelTypeEnum.XLSX , PersonDto .class);
ListimportDtoList = ExcelUtil.readExcel(excelFile,PersonDto .class);
public class PersonDto extends BaseRowModel{ /** id */ @ExcelProperty(index = 0 , value = "id") private String id; /** 姓名 **/ @ExcelProperty(index = 1 , value = "姓名") private String name; /** 生日 **/ @ExcelProperty(index = 2 , value = "生日" , format = "yyyy-MM-dd") @CellStyleFormat(fillBackgroundColor= IndexedColors.LIGHT_YELLOW) @CellFontFormat(fontColor=IndexedColors.BLACK) private String birth;}
EasyExcel github地址:
EasyExcelUtils github项目地址:
转载地址:http://rhbfa.baihongyu.com/