This commit is contained in:
parent
d3b8a38f99
commit
c7a1eaca9d
|
|
@ -223,12 +223,13 @@ public class StatementAccountController {
|
|||
// 如果填充list的对象是map,必须包涵所有list的key,哪怕数据为null,必须使用map.put(key,null)
|
||||
//docker生成路径
|
||||
//URL templateFileUrl = ResourceUtil.getResource("templates/dzd_excel_templates.xlsx");
|
||||
org.springframework.core.io.Resource resource = resourceLoader.getResource("classpath:templates/dzd_excel_templates.xlsx"); // 例如获取index.html
|
||||
String templateFileUrl = resource.getURI().toString();
|
||||
// org.springframework.core.io.Resource resource = resourceLoader.getResource("classpath:templates/dzd_excel_templates.xlsx"); // 例如获取index.html
|
||||
// String templateFileUrl = resource.getURI().toString();
|
||||
InputStream resourceAsStream = this.getClass().getResourceAsStream("templates/dzd_excel_templates.xlsx");
|
||||
String pathUrl = System.getProperty("user.dir") + "/pdffile";
|
||||
|
||||
String fileName = pathUrl+"/对账单-"+customer.getName()+"-"+DateUtil.date(statementAccount.getDate().toLocalDate()).toString("YYYYMM")+".xlsx";
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileUrl).build()) {
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(resourceAsStream).build()) {
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||
// 直接写入数据
|
||||
excelWriter.fill(models, writeSheet);
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue