Details :
 Java = jdk1.5.0_16
 O/S = Linux x86_64
 POI = 3.6

Downloaded Excel file from 
http://www.bankofengland.co.uk/markets/money/eligiblesecurities.xls
This appears to be a valid spreadsheet and I can copy it ( in binary mode ) to 
Windows and can open it in Excel (11.8320.8221 ) SP3 

When I attempt to run my code I get the following :

EXCEPTION : Invalid header signature; read 0xE011BDBFEFBDBFEF, expected 
0xE11AB1A1E011CFD0
java.io.IOException: Invalid header signature; read 0xE011BDBFEFBDBFEF, 
expected 0xE11AB1A1E011CFD0
        at org.apache.poi.poifs.storage.HeaderBlockReader.<init>
(HeaderBlockReader.java:107)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>
(POIFSFileSystem.java:151)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:317)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:298)
        at com.scb.race.eligibilityreports.EligibilityReport.getBOEList
(EligibilityReport.java:128)
        at com.scb.race.eligibilityreports.EligibilityReport.<init>
(EligibilityReport.java:42)
        at com.scb.race.eligibilityreports.EligibilityReport.main
(EligibilityReport.java:32)

Here's an extract from my code ( line 128 is commented ) :

========================================================
                try {
                        if ( DEBUG ) { System.out.println("Reading BOE file " + 
m_boeFile); }
                        File f = new File(m_boeFile);
                        InputStream is = new FileInputStream(f);
                        //XSSFWorkbook wb = new XSSFWorkbook(is);
                        HSSFWorkbook wb = new HSSFWorkbook(is);  // This is 
line 128
                        //XSSFSheet sheet = wb.getSheetAt(0);
                        HSSFSheet sheet = wb.getSheetAt(0);
                        Iterator rows = sheet.rowIterator();
                        //XSSFRow row = null;
                        HSSFRow row = null;
                        //XSSFCell cell = null;
                        HSSFCell cell = null;
                        String isin = null;
                        int rcount = 0;
                        while ( rows.hasNext() ) {
                                if ( rcount > BOE_OFFSET ) {
                                        //row = (XSSFRow)rows.next();
                                        row = (HSSFRow)rows.next();
                                        cell = row.getCell(1);
                                        if ( cell.getStringCellValue() != 
null ) {
                                                isin = cell.getStringCellValue
();
                                                if ( DEBUG ) { 
System.out.println("ISIN " + isin); }
                                                m_boeList.add(isin);
                                                rcount++;
                                        }
                                }
                        }

=================================================================

As you can see, I've tried using XSSF instead of HSSF but that failed at a 
later point and I've checked the file, it isn't XML it's binary. The file is 
definately an OK Excel spreadsheet.

I am flummoxed! Any advice gratefully accepted.




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • EXCEPTION : Invalid header signature Bob Gosling

Reply via email to