This is similar (maybe identical) to #32822. The following simple code throws the same exception as 32822 when opening a specific Excel file. Other Excel files work fine. The exception can be traced to BOFRecord.fillFields(byte [] data, short size, int offset), lines 133 and 134, where the history and rversion fields are retrieved. For this specific file, data.length = 8 which causes an exception to be thrown. However if the file is opened and saved without modification, data.length is 16 when it is opened and everything works fine. FileInputStream in = null; Statement statement = null; try{ in = new FileInputStream("c:\\temp\\contact_info.xls"); POIFSFileSystem fs = new POIFSFileSystem(in); HSSFWorkbook book = new HSSFWorkbook(fs); } catch (Exception except) { System.out.println(except); }
Created attachment 15532 [details] this is the excel file that causes the exception to be thrown
This is a BIFF 5/7 file and not a BIFF 8. The BOF record is 12 bytes. A BIFF 8 BOF record should be 20 bytes. POI only supports BIFF 8. Jason