Bug 48654 - Not able to read Excel (xls) file having drawing objects
Summary: Not able to read Excel (xls) file having drawing objects
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.6-FINAL
Hardware: PC Windows Vista
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Blocks: 53010
  Show dependency tree
Reported: 2010-02-01 22:58 UTC by Rakesh
Modified: 2012-08-15 20:19 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Rakesh 2010-02-01 22:58:24 UTC
Hi all,

I am new to this library and am trying to use HSSF for reading an excel file and then writing the output to one of its Sheet. Currently I am facing this issue:

My excel file contains some of the drawing objects. That causes HSSF throw this error when I try to create a workbook for the input file,

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
        at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:64)
        at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:263)
        at org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:270)
        at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:236)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:392)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:276)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:317)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)

However, when I remove all the drawing objects from the input excel it reads the excel file without any issues. 
I tried to search for some workbooksetting object, which could allow me to disable(in Java) the drawing objects of the excel while reading it, or some option with which I can read the excel file even if it has the drawing objects( as the objects are critical to the project, I can not remove them).But could not find any such setting with HSSF.
Please let me know about any such option/setting if it exists in POI library.Or let me know the way to read such excel files having drawing objects.

Thanks in Advance,


Comment 1 David Fisher 2010-04-30 18:47:57 UTC
Without an example of the smallest possible file showing your bug it will be difficult to solve this bug.
Comment 2 Evgeniy Berlog 2012-08-15 20:19:35 UTC
This problem should be fixed in trunk.

Please try with a nightly build - see download links on http://poi.apache.org/
or build yourself from SVN trunk, see http://poi.apache.org/subversion.html