加入pom依赖
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
只留这个poi即可 否则测接口会报错
You need to add dependency of 'poi-ooxml' to your project, and version >= 4.1.2
controller
//导出
@RequestMapping("/excelW")
public JsonResult<?> excelW(HttpServletResponse response) {
return userAccountService.excelW(response);
}
//导入
@RequestMapping("/excelR")
public JsonResult<?> excelR(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
return userAccountService.excelR(file, request);
}
service
// 导出
JsonResult<?> excelW(HttpServletResponse response);
// 导入
JsonResult<?>
excelR(MultipartFile file, HttpServletRequest request);