-
Notifications
You must be signed in to change notification settings - Fork 465
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Search before asking
- I searched in the issues and found nothing similar.
Fesod version
1.3.0
JDK version
17
Operating system
windows11
Steps To Reproduce
public static importExcel(MultipartFile file) {
FastExcelUploadDataListener<QuestionExcel> listener = new FastExcelUploadDataListener<>();
List<QuestionFailedExcel> errorList = new ArrayList<>();
File importTempFile = null;
try {
importTempFile = File.createTempFile(UUID.randomUUID().toString(), ".xlsx");
file.transferTo(importTempFile);
FastExcel.read(importTempFile, QuestionExcel.class, listener)
.ignoreEmptyRow(false)
.sheet()
.doRead();
List<QuestionExcel> list = listener.getList();
errorList = new ArrayList<>(list);
} catch (Exception e) {
log.error("===========", e);
} finally {
if (importTempFile != null) {
importTempFile.delete();
}
}
File tempFile = null;
try {
// 创建输出文件
tempFile = File.createTempFile(UUID.randomUUID().toString(), ".xlsx");
// 加载模板
try (InputStream failedTemplate = QuestionUtil.class.getResourceAsStream("/template/excel/exam/questionFailedTemplate.xlsx");) {
// 读取模板并写入数据(忽略注解中的表头)
FastExcel.write(tempFile)
.withTemplate(failedTemplate) // 使用模板
.sheet()// 默认第一个 sheet
.head(QuestionFailedExcel.class)
.needHead(false)
.doWrite(errorList); // 写入数据列表
} catch (Exception e) {
log.error("写入错误信息失败", e);
throw new ServiceException("写入错误信息失败");
}
}
Current Behavior
FastExcel.write出来的文件会有FastExcel.read中的公式,如wps的嵌入图片
Expected Behavior
FastExcel.write中全是新的东西,不应该有read中的其他隐性的东西。
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working