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 to 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 a 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"));