diff --git a/README.md b/README.md index 3570699..1e3766a 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ EasyExcel是一个基于Java的简单、省内存的读写Excel的开源项目 - 项目已上传至 maven 仓库,直接引入即可使用 -| 版本 | 支持 | +| 版本 | 支持 | |-------|--| -| 3.0.0 | 适配 SpringBoot3.x | +| 3.1.0 | 适配 SpringBoot3.x | | 1.2.7 | 适配 SpringBoot2.x | ```xml @@ -466,6 +466,10 @@ public class SetConverter implements Converter> { ## 高级用法模板导出 ```java +/** + * 默认读取 classpath:excel/ 目录下的模板文件,具体模板使用参考官方文档 + * + */ @ResponseExcel(name = "模板测试excel", sheet = "sheetName",template = "example.xlsx") @GetMapping("/e1") public List e1() { diff --git a/pom.xml b/pom.xml index a5ce850..9401791 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ org.springframework.boot spring-boot-starter-parent - 3.0.0 + 3.1.1 com.pig4cloud.excel excel-spring-boot-starter - 3.0.1-SNAPSHOT + 3.1.0 excel-spring-boot-starter easy and high performance excel https://pig4cloud.com @@ -36,9 +36,9 @@ 17 - 3.1.1 + 3.3.2 3.0.0 - 0.0.32 + 0.0.39 2.2.5 1.21 diff --git a/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java b/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java index 5303c35..093d060 100644 --- a/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java +++ b/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java @@ -122,10 +122,8 @@ public ExcelWriter getExcelWriter(HttpServletResponse response, ResponseExcel re writerBuilder.excludeColumnFieldNames(Arrays.asList(responseExcel.exclude())); } - if (responseExcel.writeHandler().length != 0) { - for (Class clazz : responseExcel.writeHandler()) { - writerBuilder.registerWriteHandler(BeanUtils.instantiateClass(clazz)); - } + for (Class clazz : responseExcel.writeHandler()) { + writerBuilder.registerWriteHandler(BeanUtils.instantiateClass(clazz)); } // 开启国际化头信息处理 @@ -136,10 +134,8 @@ public ExcelWriter getExcelWriter(HttpServletResponse response, ResponseExcel re // 自定义注入的转换器 registerCustomConverter(writerBuilder); - if (responseExcel.converter().length != 0) { - for (Class clazz : responseExcel.converter()) { - writerBuilder.registerConverter(BeanUtils.instantiateClass(clazz)); - } + for (Class clazz : responseExcel.converter()) { + writerBuilder.registerConverter(BeanUtils.instantiateClass(clazz)); } String templatePath = configProperties.getTemplatePath();