@Value(value="${bill.path}")
String billPath
@Value(value="${bill.path.file}")
String billPathFile
//定义xlsx文件模板位置
String templateFile=billPath.concat(工具类.常量)
(工具类 public static String file=''template.xlsx")
//定义文件名
String fileName=name
//定义目标文件夹
String billFileofPath=billPath.concat(当前月份).concat(billPathFile)
//定义目标文件名
String fillpath=billFileofPath.concat(fileName.concat(".xlsx"));
//生成文件夹
File request =new File(billFileofPath);
if(!request .exists()){
request .mkdirs();
}
//写入模板数据
ExcelWriter excelWriter=EasyExcel.write(fillpath).withTemplate(new() File(templateFile)).build();
//生成工作表对象
WirteSheet writeSheet=EasyExcel.writeSheet.build();
//样式
FileConfig fileConfig=FileConfig.builder().forceNewRow(Boolean.FALSE).build();
//插入列表数据
excelWrite.fill(new FillWrapper("", list数据), fillConfig, writeSheet);
//对象中的数据
excelWriter.fill(实体类数据, writeSheet);
excelWriter
excel生成PDF文件
最新推荐文章于 2022-08-01 20:15:15 发布