我有密码保护的工作表与Excel 95,97-2003读密码保护的工作表(版本 - Excel中95,97-2003)的Java
创建我有密码,我试图读取不同的文件方式
方法1:
WorkbookFactory.create(inputStream, "password");
throws: org.apache.poi.EncryptedDocumentException: HSSF does not currently support CryptoAPI encryption
方法2:
protected InputStream WorkbookProtectionUnlocker(NPOIFSFileSystem fs, String password) throws AAAAException {
EncryptionInfo info;
try {
info = new EncryptionInfo(fs.getRoot());
} catch (IOException e) {
throw new AAAException(e.getCause());
}
Decryptor d = Decryptor.getInstance(info);
org.apache.poi.EncryptedDocumentException:HSSF目前不支持的CryptoAPI加密
也抛出了同样的异常
方法3:
org.apache.poi.hssf.record.crypto.Biff8EncryptionKey.setCurrentUserPassword("password");
Workbook wb = new HSSFWorkbook(new FileInputStream(file);
同样的异常。
方法4:
读到jxl.Workbook.getWorkbook
但在这种对象的密码只允许将其设置到片材而不是整个工作表。
抛出这个错误:jxl.read.biff.PasswordException
因为其无法设置密码到工作表。
方法5
org.apache.poi.hssf.record.crypto.Biff8EncryptionKey.setCurrentUserPassword(fileInfo.getFileOptions().xlsWorkbookPasswordExpression);
WorkbookFactory.create(new FileInputStream(fileInfo.getInputFile()));
相同的异常:
org.apache.poi.EncryptedDocumentException: HSSF does not currently support CryptoAPI encryption
是什么开口,其密码保护工作簿HSSF的正确方法是什么?
为了完整起见,这被填入[#60347](https://bz.apache.org/bugzilla/show_bug.cgi?id=60347) – kiwiwings