Kryptera och dekryptera ODS filer
Contents
[
Hide
]
OpenOffice.org är en komplett kontorspaket som stöder lösenordsskydd och kryptering av filer. En krypterad ODS-fil kan endast öppnas av OpenOffice efter att lösenordet har angetts. Excel kan inte öppna den krypterade ODS-filen och kan möjligen höja varningsmeddelande. Krypteringsalternativen är inte tillämpliga för ODS-filer som för andra filtyper.
Aspose.Cells tillåter att kryptera och dekryptera ODS-fil. Dekrypterad ODS-fil kan öppnas både i Excel och OpenOffice.
Kryptera med OpenOffice Calc
- Välj Spara som och klicka på Spara med lösenord-rutan.
- Klicka på Spara-knappen.
- Skriv ditt önskade lösenord i både Ange lösenord för att öppna och Bekräfta lösenord-fälten i dialogrutan Ange lösenord som öppnas.
- Klicka på OK-knappen för att spara filen.
Kryptera ODS-fil med Aspose.Cells för .Net
För att kryptera en ODS-fil, ladda in filen och ställ in WorkbookSettings.Password-värdet till det faktiska lösenordet innan du sparar den. Den utmatade krypterade ODS-filen kan öppnas i OpenOffice endast.
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 in filen genom att ange ett lösenord i LoadOptions.Password. När filen har laddats, ställ in strängen för WorkbookSettings.Password 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"); |