強力な暗号化タイプの設定

Microsoft Excel で暗号化を適用する

Microsoft Excel (2007 など) でファイル暗号化を実装するには:

  1. からツールメニュー、選択オプション.
  2. を選択安全タブ。
  3. の値を入力します開くためのパスワード分野。
  4. クリック高度.
  5. 暗号化タイプを選択し、パスワードを確認します。

Aspose.Cells による暗号化の適用

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

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiate a Workbook object.
// Open an excel file.
Workbook workbook = new Workbook(dataDir+ "Book1.xlsx");
// Specify Strong Encryption type (RC4,Microsoft Strong Cryptographic Provider).
workbook.SetEncryptionOptions(EncryptionType.StrongCryptographicProvider, 128);
// Password protect the file.
workbook.Settings.Password = "1234";
// Save the Excel file.
workbook.Save(dataDir+ "encryptedBook1.out.xls");