Node.js経由のC++を使用して強い暗号化タイプを設定する

Microsoft Excelでの暗号化の適用

Microsoft Excel(たとえば2007)でファイルの暗号化を実装するには:

  1. ツールメニューからオプションを選択します。
  2. セキュリティタブを選択します。
  3. 開くためのパスワードフィールドに値を入力します。
  4. 高度 をクリックします。
  5. 暗号化方式を選択し、パスワードを確認します。

Aspose.Cellsを使用した暗号化の適用

以下のコード例は、ファイルに強力な暗号化を適用し、パスワードを設定します。

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