ODS Dateien verschlüsseln und entschlüsseln
Mit OpenOffice Calc verschlüsseln
- Wählen Sie Speichern unter und aktivieren Sie das Kästchen Mit Passwort speichern.
- Klicken Sie auf die Speichern-Schaltfläche.
- Geben Sie Ihr gewünschtes Passwort in die Felder Kennwort eingeben zum Öffnen und Kennwort bestätigen im Fenster Passwort festlegen ein, das geöffnet wird.
- Klicken Sie auf die Schaltfläche OK, um die Datei zu speichern.
ODS-Datei mit Aspose.Cells für .Net verschlüsseln
Für die Verschlüsselung einer ODS-Datei laden Sie die Datei und setzen Sie den Wert WorkbookSettings.Password auf das tatsächliche Passwort, bevor Sie sie speichern. Die verschlüsselte Ausgabedatei im ODS-Format kann nur in OpenOffice geöffnet werden.
// 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"); |
ODS-Datei mit Aspose.Cells für .Net entschlüsseln
Für das Entschlüsseln einer ODS-Datei laden Sie die Datei, indem Sie ein Passwort in LoadOptions.Password angeben. Sobald die Datei geladen ist, setzen Sie den Wert WorkbookSettings.Password auf 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"); |