On Fri, 23 Sep 2011, ndrewh wrote:
I'm trying to open an encrypted XLSX file with the following code:

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("Book1.xlsx"));
EncryptionInfo info = new EncryptionInfo(fs);
Decryptor d = new Decryptor(info);
d.verifyPassword("hula");
XSSFWorkbook wb = new XSSFWorkbook(d.getDataStream(fs));

But, I still get this error: Exception in thread "main"
org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data
appears to be in the Office 2007+ XML.

Looks like your xlsx file isn't encrypted after all. Just pass the File to XSSFWorkbook and it should be able to open it just fine, no need to go via POIFSFileSystem and the Decryptor

Nick

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

Reply via email to