使用Selenium WebDriver读取受密码保护的Xlsx文件

时间:2019-10-07 13:03:28

标签: java selenium-webdriver apache-poi

尝试使用Selenium Webdriver执行以下代码。这是代码:

NPOIFSFileSystem fileSystem = new NPOIFSFileSystem(new File("Filepath.xlsx"));
EncryptionInfo info = new EncryptionInfo(fileSystem);
Decryptor decryptor = Decryptor.getInstance(info);

if (!decryptor.verifyPassword("ActualPassword")) {
    System.out.println("Unable to process: document is encrypted.");
    return;
}

InputStream dataStream = decryptor.getDataStream(fileSystem);

excelSheet = new XSSFWorkbook(dataStream);

哪个抛出以下错误:

  

org.apache.poi.EncryptedDocumentException:不支持的哈希算法

0 个答案:

没有答案