Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
mukesh kumar
org.apache.poi.poifs.filesystem.OfficeXmlFileException
October 9, 2012 4:58 AM
Answer

mukesh kumar

Rank: Junior Member

Posts: 57

Join Date: March 12, 2012

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
Vishal Panchal
RE: org.apache.poi.poifs.filesystem.OfficeXmlFileException
October 9, 2012 5:28 AM
Answer

Vishal Panchal

Rank: Expert

Posts: 277

Join Date: May 20, 2012

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
mukesh kumar
RE: org.apache.poi.poifs.filesystem.OfficeXmlFileException
October 9, 2012 10:38 PM
Answer

mukesh kumar

Rank: Junior Member

Posts: 57

Join Date: March 12, 2012

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
Vishal Panchal
RE: org.apache.poi.poifs.filesystem.OfficeXmlFileException
October 9, 2012 10:51 PM
Answer

Vishal Panchal

Rank: Expert

Posts: 277

Join Date: May 20, 2012

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