public void upload(MultipartFile multipartFile, String type) {
File tempFile = null;
try {
tempFile = File.createTempFile(multipartFile.getOriginalFilename(), ".tep");
multipartFile.transferTo(tempFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
// 这里 需要指定读用哪个class去读,然后读取sheet
EasyExcel.read(tempFile, ComparisonSpotEvaluationResultsExcel.class, new ComparisonSpotEvaluationResultsListener(this,type)).sheet()
// 这里可以设置1,因为头就是一行。如果多行头,可以设置其他值。不传入也可以,因为默认会根据DemoData 来解析,他没有指定头,也就是默认1行
.headRowNumber(2).doRead();
tempFile.delete();
}
09-25
1万+
10-26
518
02-04
153
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交