I'm trying to create XSSFWorkbook from file.xlsx by calling:
1. XSSFWorkbookFactory.create(file) -> return HSSFWorkbook
2. WorkbookFactory.createXSSFWorkbook(file) -> While trying to invoke 'createWorkbook' on factory org.apache.poi.xssf.usermodel.XSSFWorkbookFactory and arguments [path to file.xlsx]
3. OPCPackage.open(file) -> The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (eg HSSF instead of XSSF)
XSSFWorkbook wb = new XSSFWorkbook(pkg);
4. XSSFWorkbookFactory.createWorkbook(new FileInputStream(file)) -> The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (eg HSSF instead of XSSF)
I need to read a file as XSSFWorkbook to read and set new params to chart. Any ideas, why I catch this errors and why way from item 1 returns HSSFWorkbook?
I checked several times, the file has .xlsx extension.