POI读取excel报错
由于有时候上传的是xls文件有时候上传的是xlsx文件,使用POIFSFileSystem来读取文件
1 | POIFSFileSystem poifsFileSystem; |
经常会遇到
1 | The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF) |
解决方法:
使用WorkbookFactory来读取excel文件
1 | Workbook workbook; |