Bug 55505 - CountryRecord not found
Summary: CountryRecord not found
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.10-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-29 19:30 UTC by Martin Studer
Modified: 2015-06-01 21:30 UTC (History)
0 users



Attachments
Excel file to reproduce issue (109.00 KB, application/vnd.ms-excel)
2013-08-29 19:30 UTC, Martin Studer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Studer 2013-08-29 19:30:40 UTC
Created attachment 30785 [details]
Excel file to reproduce issue

Attached is an xls file that was produced via Crystal Reports. Opening the file and trying to add a sheet leads to the following exception:

Exception in thread "main" java.lang.RuntimeException: CountryRecord not found
	at org.apache.poi.hssf.model.LinkTable.<init>(LinkTable.java:265)
	at org.apache.poi.hssf.model.InternalWorkbook.getOrCreateLinkTable(InternalWorkbook.java:1794)
	at org.apache.poi.hssf.model.InternalWorkbook.checkSheets(InternalWorkbook.java:741)
	at org.apache.poi.hssf.model.InternalWorkbook.setSheetName(InternalWorkbook.java:585)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.createSheet(HSSFWorkbook.java:789)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.createSheet(HSSFWorkbook.java:73)


The code to reproduce this is:

Workbook wb = WorkbookFactory.create(new File("ReportB.xls"));
wb.createSheet("test");

Opening the file in Excel and saving it again produces a file that can be read and modified without any problems. I guess Excel simply assumes a default CountryRecord in this case. If this is the case, it would probably make sense to assume a default CountryRecord as well rather than throwing an exception.