https://issues.apache.org/bugzilla/show_bug.cgi?id=54392
Bug ID: 54392
Summary: HSSFWorkbook initialization fail, with
RuntimeException during creation of HSSFSheet, caused
by an unknown excel format
Product: POI
Version: 3.9
Hardware: PC
OS: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
poi version: poi-3.9-20121203.jar
platform: windows xp
------------ source to reproduce is very simple:
String s = "excelfile.xls";
FileInputStream fis = new FileInputStream(file);
workbook = new HSSFWorkbook (fis);
and then it would trigger this.
it would be nice if it can be fixed. or at least with an extra constructor
boolean to disable this check & throw.
// Some tools (like Perl module Spreadsheet::WriteExcel -
bug 41187) skip the RowRecords
// Excel, OpenOffice.org and GoogleDocs are all OK with
this, so POI should be too.
if (rowRecordsAlreadyPresent) {
// if at least one row record is present, all should be
present.
throw new RuntimeException("Unexpected missing row when
some rows already present");
}
Since I am very eager to use poi for this excel file, I disabled this throw
statement and the rest of the parising can run perfectly fine.
------------ Exception:
Error initializing Excel File:Unexpected missing row when some rows already
present
java.lang.RuntimeException: Unexpected missing row when some rows already
present
at
org.apache.poi.hssf.usermodel.HSSFSheet.setPropertiesFromSheet(HSSFSheet.java:195)
at org.apache.poi.hssf.usermodel.HSSFSheet.<init>(HSSFSheet.java:120)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:292)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:243)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:187)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:322)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:303)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]