Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rp2018
Creator
Creator

Java code to disable Excel Protected file

We have an Excel email attachment which is in the protective mode and would like to disable it.

We only want to disable only this one particular report file and not others.

After google research found following code to implement in tJava but not working.

What do I need to import under the Advanced settings in order for this to work?

// Open the Excel file

Workbook workbook = new Workbook("C:/Temp/TestReport.xlsx");

// Unprotect workbook

workbook.unprotect("12345");

// Set password to null

workbook.getSettings().setPassword(null);

// Save the file

workbook.save("C:/Temp/Attachment/UnProtectTestReport.xlsx");

Labels (3)
0 Replies