HTML JPG PDF XML XLSM
Aspose.Cells  for C++
XLSM

Unlock XLSM Files via C++

Remove protection from Excel spreadsheets including XLSM file using C++ Library.

How to Remove Protection of XLSM File Using C++

In order to unlock XLSM file, we’ll use

Aspose.Cells for C++

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

NuGet

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 XLSM via C++

You need

aspose.cells.dll

referenced in your project to execute the following workflow.

  1. Load XLSM locked file using CreateIWorkbook.
  2. Call Unprotect() function to unlock.
  3. Set password to NULL using SetPassword.
  4. Save XLSM 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 XLSM file
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(srcDir->StringAppend(new String("sampleExcelFileProtected.xlsm")));

// Unprotect workbook
workbook->Unprotect(new String("12345"));

// Set password to null
workbook->GetISettings()->SetPassword(NULL);

// Save the XLSM file
workbook->Save(outDir->StringAppend(new String("sampleExcelFileUnprotected_out.xlsm")));
 
  • About Aspose.Cells for C++ API

    Aspose.Cells API can be used to create, edit, convert and render Microsoft Excel formats to different formats. Moreover, it can be used for comprehensive charting, scalable reporting and reliable calculations within software applications. Aspose.Cells is a standalone API and it does not require any software like Microsoft or OpenOffice.

    Free App to Unlock XLSM

    Other Supported Unlocking Formats

    Using C++, one can easily remove protection / unlocking of different formats including.

    ODS (OpenDocument Spreadsheet File)
    XLS (Excel Binary Format)
    XLSB (Binary Excel Workbook File)
    XLSX (OOXML Excel File)