使用EasyPoi导入Excel直接读流(不保存到本地文件)

直接上代码


//关键代码
CommonsMultipartFile cFile = (CommonsMultipartFile) file;
DiskFileItem fileItem = (DiskFileItem) cFile.getFileItem();
InputStream inputStream = fileItem.getInputStream();

ImportParams params = new ImportParams();

//直接转实体
List<YourEntity> entities = ExcelImportUtil.importExcel(inputStream, YourEntity.class, params);

你可能感兴趣的:(#,JavaWeb)