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

OpenOffice Calcで暗号化

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

ODSファイルの暗号化(暗号化とパスワード保護)にAspose.Cells for Python via .NETを使用します。

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

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
sourceDir = RunExamples.Get_SourceDirectory()
# Output directory
outputDir = RunExamples.Get_OutputDirectory()
# Open an ODS file
workbook = Workbook(sourceDir + "sampleODSFile.ods")
# Password protect the file
workbook.settings.password = "1234"
# Save the ODS file
workbook.save(outputDir + "outputEncryptedODSFile.ods")

Aspose.Cells for Python via .NETを使って、強力な暗号化タイプのExcelファイルを暗号化し、パスワード保護することも可能です。

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

from aspose.cells import LoadFormat, LoadOptions, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
sourceDir = RunExamples.Get_SourceDirectory()
# Output directory
outputDir = RunExamples.Get_OutputDirectory()
# Open an encrypted ODS file
loadOptions = LoadOptions(LoadFormat.ODS)
# Set original password
loadOptions.password = "1234"
# Load the encrypted ODS file with the appropriate load options
workbook = Workbook(sourceDir + "sampleEncryptedODSFile.ods", loadOptions)
# Set the password to null
workbook.settings.password = None
# Save the decrypted ODS file
workbook.save(outputDir + "outputDecryptedODSFile.ods")