Setting Strong Encryption Type

Applying Encryption with Microsoft Excel

To implement file encryption in Microsoft Excel (for example 2007):

  1. From the Tools menu, select Options.

  2. Select the Security tab.

  3. Enter a value for the Password to open field.

  4. Click Advanced.

  5. Choose the encryption type and confirm the password.

    Setting encryption in Microsoft Excel

todo:image_alt_text

Applying Encryption with Aspose.Cells

The code example below applies strong encryption on a file and sets a password.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
String dataDir = Utils.getDataDir(ApplyingEncryption.class);
// Instantiate a Workbook object.
Workbook workbook = new Workbook(dataDir + "Book1.xls");
// Password protect the file.
workbook.getSettings().setPassword("1234");
// Specify Strong Encryption type (RC4,Microsoft Strong Cryptographic Provider).
workbook.setEncryptionOptions(EncryptionType.STRONG_CRYPTOGRAPHIC_PROVIDER, 128);
// Save the Excel file.
workbook.save(dataDir + "encryptedBook1.xls");