Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
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