打开由Java POI创build的Excel表单时出现错误消息

在使用Java POI生成Excel表格并打开新创build的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:

  • 对于.xls文件,您必须使用HSSF。
  • 对于.xlsx文件,您必须使用XSSF或更高版本的api。

检查你的excel文件是否正确。 为了正确的答案,请提供一些代码。