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.
fixed via r1876805
as of poi 4.1.2 with HSSF still a problem with Crystal Reports(CR) generated files, but not all xls generated CR reports. Happens with "sheet.shift(x,y,z) It is fixed opening in Excel and saving, not possible in production or processing an InputStream. Is there a default CountryRecord that can be created and assigned to prevent this through the API? tia. java.lang.RuntimeException: CountryRecord not found
please do not reopen issues - the recent changes are not yet released - will be in 5.0.0 release when that is ready for release