Matt Rogghe
2012-03-15 16:16:18 UTC
I've been experimenting with opening password protected (not encrypted) workbooks. The HSSF (2003 and lower) versions seem to work fine when using the org.apache.poi.hssf.record.crypto.Biff8EncryptionKey methods. The XSSF methods seem to be problematic.
poi-3.8-beta5
Using the following methods to determine workbook version and get an object to work with: POIFSFileSystem.hasPOIFSHeader(inputStream), POIXMLDocument.hasOOXMLHeader(inputStream) as well as the generic WorkbookFactory.create(inputStream).
When I come across a 2007+ workbook that has been saved as password protected POI determines that the file is in HSSF/BIFF format.
Error generated:
The supplied POIFSFileSystem does not contain a BIFF8 'Workbook' entry. Is it really an excel file?
Has anyone had success opening password protected 2007+ files?
Steps to reproduce:
1. Create a new Excel file using Excel 2007+.
2. Save As ->
3. Click Tools -> General Options
4. Enter a password in both or either fields.
5. OK and save.
6. Attempt to read the file using POI.
poi-3.8-beta5
Using the following methods to determine workbook version and get an object to work with: POIFSFileSystem.hasPOIFSHeader(inputStream), POIXMLDocument.hasOOXMLHeader(inputStream) as well as the generic WorkbookFactory.create(inputStream).
When I come across a 2007+ workbook that has been saved as password protected POI determines that the file is in HSSF/BIFF format.
Error generated:
The supplied POIFSFileSystem does not contain a BIFF8 'Workbook' entry. Is it really an excel file?
Has anyone had success opening password protected 2007+ files?
Steps to reproduce:
1. Create a new Excel file using Excel 2007+.
2. Save As ->
3. Click Tools -> General Options
4. Enter a password in both or either fields.
5. OK and save.
6. Attempt to read the file using POI.