I personally use the workbook factory to open encrypted documents: this.currentWorkbook=WorkbookFactory.create(inputStream, password)
Cf here https://github.com/ZuInnoTe/hadoopoffice/blob/master/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/parser/MSExcelParser.java > On 15. Jun 2017, at 16:19, Sateesh K Kolusu <[email protected]> wrote: > > Here is the code > > fileIn = new FileInputStream(file); > POIFSFileSystem poiFS = new POIFSFileSystem(fileIn); > fileIn.close(); > fileIn = null; //FAILS HERE > EncryptionInfo encInfo = new EncryptionInfo(poiFS); > Decryptor decryptor = Decryptor.getInstance(encInfo); // > In case of POI 3.8 > if (decryptor != null) > { > if ((password != null) && (password.length() > 0) && > (decryptor.verifyPassword(password) == true)) > { > fileIn = decryptor.getDataStream(poiFS); > poiFS = null; > workbook = new > XSSFWorkbook(OPCPackage.open(fileIn)); > } > else > { > (INVALID_PASSWORD"); ^M > } > } > > > --- > Thanks > Sateesh K Kolusu > Software Engineer - Connectivity > IBM Analytics > > > > From: Dominik Stadler <[email protected]> > To: POI Users List <[email protected]> > Date: 06/15/2017 06:57 PM > Subject: Re: excel processing differences > > > > Can you share the relevant code in SSFile? > > Dominik > > On Jun 15, 2017 14:03, "Sateesh K Kolusu" <[email protected]> > wrote: > > Hello all - > Good day. We have a password XLS sheet with macros and when we use MS > Office 2010 to save the file as "Excel97-2003" format, we are able to read > the file and process the file. > > If we use MS Office 2013 (and higher. I used 2016) and save the file as > "Excel97-2003" format, then we are not able to read the file. It gives > error > > java.io.FileNotFoundException: no such entry: "EncryptionInfo", had: > [ CompObj, _VBA_PROJECT_CUR, DocumentSummaryInformation, > SummaryInformation, Workbook] > at > org.apache.poi.poifs.filesystem.DirectoryNode.getEntry(DirectoryNode.java: > 399) > at > org.apache.poi.poifs.filesystem.DirectoryNode.createDocumentInputStream( > DirectoryNode.java:188) > at > org.apache.poi.poifs.crypt.EncryptionInfo.<init>(EncryptionInfo.java:94) > at > org.apache.poi.poifs.crypt.EncryptionInfo.<init>(EncryptionInfo.java:76) > at com.ibm.is.cc.unstructured.poi.SSFile.readFile(SSFile.java:169) > at > com.ibm.is.cc.unstructured.api.ExcelFile.readFile(ExcelFile.java:143) > > I am using POI 3.14 > > > --- > Thanks > Sateesh > > > >
