Setting Strong Encryption Type with Node.js via C++

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.

Applying Encryption with Aspose.Cells

The code examples below apply strong encryption on a file and set a password.

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "Book1.xlsx");

// Instantiate a Workbook object.
// Open an excel file.
const workbook = new AsposeCells.Workbook(filePath);

// Specify Strong Encryption type (RC4,Microsoft Strong Cryptographic Provider).
workbook.setEncryptionOptions(AsposeCells.EncryptionType.StrongCryptographicProvider, 128);

// Password protect the file.
workbook.getSettings().setPassword("1234");

// Save the Excel file.
workbook.save(path.join(dataDir, "encryptedBook1.out.xls"));