Kryptera och dekryptera ODS-filer
Contents
[
Hide
]
OpenOffice.org är en fullfjädrad kontorssvit som stöder lösenordsskyddande och kryptering av filer. Krypterad ODS-fil kan dock endast öppnas av OpenOffice efter att ha angett lösenordet. Excel kan inte öppna den krypterade ODS-filen och kan ge ett varningsmeddelande. Krypteringsalternativen är inte tillämpliga för ODS-filen till skillnad från andra filtyper.
Aspose.Cells gör det möjligt att kryptera och dekryptera ODS-filen. Dekrypterad ODS fil kan öppnas både i Excel och OpenOffice,
Kryptera med OpenOffice Calc
- VäljSpara som och klicka påSpara med lösenord låda.
- Klicka påSpara knapp.
- Skriv ditt önskade lösenord i bådeAnge lösenord för att öppna ochBekräfta lösenord fälten i fönstret Ange lösenord som öppnas.
- Klicka påOK knappen för att spara filen.
Kryptera ODS-filen med Aspose.Cells för .Net
För att kryptera en ODS-fil, ladda filen och ställ inArbetsbok Inställningar. Lösenord värde till det faktiska lösenordet innan du sparar det. Den utdatakrypterade ODS-filen kan endast öppnas i OpenOffice.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
Dekryptera ODS-fil med Aspose.Cells för .Net
För att dekryptera en ODS-fil, ladda filen genom att ange ett lösenord iLoadOptions.Password . När filen är laddad, ställ inArbetsbok Inställningar. Lösenord sträng till null.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |