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 <dominik.stad...@gmx.at>
To:     POI Users List <user@poi.apache.org>
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" <sateesh.kol...@in.ibm.com> 
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




Reply via email to