HTML
JPG
PDF
XML
ODS
ODS
Unlock ODS Files via C++
Remove protection from Excel spreadsheets including ODS file using C++ Library.
How to Remove Protection of ODS File Using C++
In order to unlock ODS file, we’ll use
API which is a feature-rich, powerful and easy to use document protection API for C++ platform. You can download its latest version directly, just open
package manager, search for Aspose.Cells.Cpp and install. You may also use the following command from the Package Manager Console.
Aspose.Cells
PM> Install-Package Aspose.Cells.Cpp
Unlock ODS via C++
You need
referenced in your project to execute the following workflow.
- Load ODS locked file using CreateIWorkbook.
- Call Unprotect() function to unlock.
- Set password to NULL using SetPassword.
- Save ODS file at a specified location.
System Requirements
Aspose.Cells for C++ supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
- Add reference to the Aspose.Cells for C++ DLL in your project.
Command
// Source directory path.
StringPtr srcDir = new String("SourceDirectory\\");
// Output directory path.
StringPtr outDir = new String("OutputDirectory\\");
// Load ODS file
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(srcDir->StringAppend(new String("sampleExcelFileProtected.ods")));
// Unprotect workbook
workbook->Unprotect(new String("12345"));
// Set password to null
workbook->GetISettings()->SetPassword(NULL);
// Save the ODS file
workbook->Save(outDir->StringAppend(new String("sampleExcelFileUnprotected_out.ods")));