0

After I generate a password protected xlsx file with apache poi, I modify file content with XSSFWorkbook.like:

File file = new File("Test2.xlsx");
XSSFWorkbook wb = (XSSFWorkbook) WorkbookFactory.create(file, "password");
wb.createSheet("Test0001");
try (FileOutputStream fileOutputStream = new FileOutputStream(file)) {
    wb.write(fileOutputStream);
} finally {
    wb.close();
}

when I reopen the file, the file was no longer password protected,Apache POI and poi-ooxml version:5.2.1.Maybe poi not support modify password protected xlsx file?

is there anyway modify password protected xlsx file with apache poi?

  • see comments under this (outdated) answer: https://stackoverflow.com/a/8988121/724039 – Luuk Jan 06 '23 at 08:20
  • Thanks,I already see it,but not found any way to edit encrypt xlsx file with apache poi. – search-coder Jan 06 '23 at 08:38
  • 1
    When you're done making changes, save with an encryption password rather than the clear-text save in your code? https://poi.apache.org/encryption.html – Gagravarr Jan 06 '23 at 12:01

0 Answers0