我想爲我的word文件(.doc)添加密碼。我在谷歌搜索它,但只找到(.docx)的解決方案。誰能幫我?我正在使用此代碼,但輸出文件沒有密碼。添加帶密碼apache poi的word(.doc)文件
FileInputStream in = new FileInputStream("Doccc.doc");
BufferedInputStream bin = new BufferedInputStream(in);
POIFSFileSystem poiFileSystem = new POIFSFileSystem(bin);
Biff8EncryptionKey.setCurrentUserPassword("[email protected]");
HWPFDocument doc = new HWPFDocument(poiFileSystem);
Range range = doc.getRange();
FileOutputStream out = new FileOutputStream("Doccc.doc");
doc.write(out);
out.close();
你看過[Apache POI支持的加密/密碼保護矩陣](http://poi.apache.org/encryption.html)嗎? – Gagravarr
@Gagravarr是的。在該指南中不支持.doc文件,它只支持.docx文件。任何人都可以提出另一種方式? – kids