使用 Java POI 生成 Excel 工作表并打开新创建的 Excel 文件后,我会收到一个消息框,显示
Excel found unreadable content in "abc.xlxs" .Do you want to recover the contents of this workbook?If you trust the source of this workbook, click 'yes'.
当我单击“是”时,我收到类似这样的消息
Excel was able to open the file by repairing or removing the unreadable content
之后我可以查看工作表中的内容。如何在打开它时删除所有这些类型的消息?
您应该检查您是否使用了正确的API:
检查你的excel文件是否正确写入。 为了获得正确的答案,请提供一些代码。
面临类似的问题,但就我而言,Excel 文件本身无法打开
工作簿wb = new XSSFWorkbook();
OutputStream fileOut = new FileOutputStream(CucumberRunner.testFilePath+"\AutomationTestResult.xlsx");
System.out.println(CucumberRunner.testFilePath+"\AutomationTestResult.xlsx Excel 文件已成功创建。");
wb.write(fileOut);
XSSFWorkbook 工作簿 = new XSSFWorkbook();
XSSFSheet Sheet = workbook.createSheet("一月");
XSSFRow rowhead =sheet.createRow((短)0);
rowhead.createCell(0).setCellValue("S.No.");
rowhead.createCell(1).setCellValue("客户名称");
rowhead.createCell(2).setCellValue("账号");
rowhead.createCell(3).setCellValue("电子邮件");
rowhead.createCell(4).setCellValue("余额");