You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Matt Rogghe <mr...@blazent.com> on 2012/03/15 17:16:18 UTC

Excel 2007+ with password protection

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.

Re: Excel 2007+ with password protection

Posted by Nick Burch <ni...@alfresco.com>.
On Thu, 15 Mar 2012, Matt Rogghe wrote:
> 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.

See http://poi.apache.org/encryption.html for details on how to read .xlsx 
password protected files

> When I come across a 2007+ workbook that has been saved as password 
> protected POI determines that the file is in HSSF/BIFF format.

Password protected .xlsx files are slightly confusingly wrapped in an OLE2 
container

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org