Fórumok

org.apache.poi.poifs.filesystem.OfficeXmlFileException

thumbnail
mukesh kumar, módosítva 11 év-val korábban

org.apache.poi.poifs.filesystem.OfficeXmlFileException

Junior Member Bejegyzések: 57 Csatlakozás dátuma: 2012.03.13. Legújabb bejegyzések
Hi
i am trying insert excel value int DB . But i am getting the exception called
org.apache.poi.poifs.filesystem.OfficeXmlFileException
.

In console i am getting the below error

11:48:16,771 INFO [PortletHotDeployListener:433] 1 portlet for Excelread-portlet is available for use
1
org.apache.poi.poifs.filesystem.OfficeXmlFileException: 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)
11:48:21,639 INFO [PluginPackageUtil:1408] Checking for available updates
11:48:21,641 INFO [PluginPackageUtil:1452] Finished checking for available updates in 1 ms

How to resolve the given issue.
Regards
Mukesh Kumar
thumbnail
Vishal Panchal, módosítva 11 év-val korábban

RE: org.apache.poi.poifs.filesystem.OfficeXmlFileException

Expert Bejegyzések: 289 Csatlakozás dátuma: 2012.05.20. Legújabb bejegyzések
mukesh kumar:
Hi
i am trying insert excel value int DB . But i am getting the exception called
org.apache.poi.poifs.filesystem.OfficeXmlFileException
.

In console i am getting the below error

11:48:16,771 INFO [PortletHotDeployListener:433] 1 portlet for Excelread-portlet is available for use
1
org.apache.poi.poifs.filesystem.OfficeXmlFileException: 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)
11:48:21,639 INFO [PluginPackageUtil:1408] Checking for available updates
11:48:21,641 INFO [PluginPackageUtil:1452] Finished checking for available updates in 1 ms

How to resolve the given issue.
Regards
Mukesh Kumar


Hi
It seem s like you are trying to insert values in xlsx file but not in xls.
The error itself describes that you should use XSSF instead of HSSF .
why because HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format while XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xlsx) file format.

find an example here

Thanks & Regards,
Vishal R. Panchal
thumbnail
mukesh kumar, módosítva 11 év-val korábban

RE: org.apache.poi.poifs.filesystem.OfficeXmlFileException

Junior Member Bejegyzések: 57 Csatlakozás dátuma: 2012.03.13. Legújabb bejegyzések
thanks . but again i am getting
java.lang.IllegalStateException: Cannot get a text value from a numeric cell


Actually i am trying to insert date field value which available in ExcelSheet into DB.
Format of Date field is like "12 JAN " What should be appropriate data type for date field whether it would be date or string .
can you please give me some idea.

Regards,

Mukesh Kumar

8867789475
thumbnail
Vishal Panchal, módosítva 11 év-val korábban

RE: org.apache.poi.poifs.filesystem.OfficeXmlFileException

Expert Bejegyzések: 289 Csatlakozás dátuma: 2012.05.20. Legújabb bejegyzések
mukesh kumar:
thanks . but again i am getting
java.lang.IllegalStateException: Cannot get a text value from a numeric cell


Actually i am trying to insert date field value which available in ExcelSheet into DB.
Format of Date field is like "12 JAN " What should be appropriate data type for date field whether it would be date or string .
can you please give me some idea.

Regards,

Mukesh Kumar

8867789475


Hi mukesh,

All you need to do is to parse your string to datetime format.

You can do this using , an example of the same is given here.


Thanks & Regards,
Vishal R. Panchal