Message Boards

org.apache.poi.poifs.filesystem.OfficeXmlFileException

thumbnail
mukesh kumar, modified 11 Years ago.

org.apache.poi.poifs.filesystem.OfficeXmlFileException

Junior Member Posts: 57 Join Date: 3/13/12 Recent Posts
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, modified 11 Years ago.

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

Expert Posts: 289 Join Date: 5/20/12 Recent Posts
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, modified 11 Years ago.

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

Junior Member Posts: 57 Join Date: 3/13/12 Recent Posts
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, modified 11 Years ago.

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

Expert Posts: 289 Join Date: 5/20/12 Recent Posts
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