咔片PPT · AI自动生成演示文稿,模板丰富、排版精美 讯飞智文 · 一键生成PPT和Word,高效应对学习与办公

在 Spring Boot 中使用 @RequestExcel 和 @ResponseExcel 注解即可轻松上传和下载 Excel 文件。

使用

下载示例,类似于 @ResponseBody :

@RequestMapping("/download") @ResponseExcel({"name", "book.name", "book.author"}) public List download() { return listCharacters(); }

上传示例,类似于 @RequestParam :

@RequestMapping("/upload") @ResponseBody public List upload(@RequestExcel(value = "excel", targetClass = Character.class, fieldNames = {"name", "book.name", "book.author"}) List characters) { return characters; }

已提交至 Maven 中央仓库,引入以下依赖即可使用:

com.gaoice easyexcel-spring-boot-starter 2.0

可在 GitHub 上搜索此项目,查看项目源码和更多的使用示例哦。