Excel Encryption for XLS in Java
XLS encryption enables you to securely protect the content of your Excel workbook (XLS) from unwanted viewers.
Following example shows how to load encrypted XLS file and how to save workbook as encrypted XLS file in Java.
Input and output password should be specified in the appropriate text box. If password is empty, file won't be decrypted / encrypted.

import com.gembox.spreadsheet.*;
class Program {
public static void main(String[] args) throws java.io.IOException {
// If using Professional version, put your serial key below.
SpreadsheetInfo.setLicense("FREE-LIMITED-KEY");
String inputPassword = "%InputPassword%";
String outputPassword = "%OutputPassword%";
XlsLoadOptions loadOptions = new XlsLoadOptions();
loadOptions.setPassword(inputPassword);
ExcelFile workbook = ExcelFile.load("%InputFileName%", loadOptions);
XlsSaveOptions saveOptions = new XlsSaveOptions();
saveOptions.setPassword(outputPassword);
workbook.save("XLS Encryption.xls", saveOptions);
}
}
Want more?
Like it?
Published: December 13, 2018 | Modified: September 9, 2019 | Author: Marek Turis