ODSファイルの暗号化と複合化

OpenOffice Calcで暗号化

  1. 「名前を付けて保存」を選択し、「パスワードで保存」ボックスをクリックします。
  2. 保存ボタンをクリックします。
  3. 開いた「パスワードの設定」ウィンドウの「開くためのパスワードを入力」および「パスワードを確認」フィールドに希望するパスワードを入力します。
  4. ファイルを保存するために OK ボタンをクリックします。

Aspose.Cells for .NETでODSファイルを暗号化

ODSファイルを暗号化するには、ファイルを読み込んで保存する前にWorkbookSettings.Passwordの値を実際のパスワードに設定します。出力される暗号化されたODSファイルは、OpenOfficeでのみ開くことができます。

// 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 sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
// Open an ODS file
Workbook workbook = new Workbook(sourceDir + "sampleODSFile.ods");
// Password protect the file
workbook.Settings.Password = "1234";
// Save the ODS file
workbook.Save(outputDir + "outputEncryptedODSFile.ods");

Aspose.Cells for .NETでODSファイルを複合化

ODSファイルを復号化するには、LoadOptions.Passwordによるパスワードの提供でファイルを読み込みます。ファイルが読み込まれたら、WorkbookSettings.Password文字列をnullに設定します。

// 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 sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
// Open an encrypted ODS file
Aspose.Cells.LoadOptions loadOptions = new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Ods);
// Set original password
loadOptions.Password = "1234";
// Load the encrypted ODS file with the appropriate load options
Workbook workbook = new Workbook(sourceDir + "sampleEncryptedODSFile.ods", loadOptions);
// Set the password to null
workbook.Settings.Password = null;
// Save the decrypted ODS file
workbook.Save(outputDir + "outputDecryptedODSFile.ods");