Proteggi e Sblocca la Struttura del Workbook con C++

Proteggi e Sblocca la Struttura del Workbook in MS Excel

proteggere e difendere la struttura del workbook

  1. Fare clic su Revisione > Proteggi Cartella di Lavoro.
  2. Inserire una password nella casella di Password.
  3. Selezionare OK, reinserire la password per confermarla e quindi selezionare di nuovo OK.

Proteggi la Struttura del Workbook usando Aspose.Cells for C++

È sufficiente utilizzare le seguenti linee di codice per implementare la protezione della struttura della cartella di lavoro dei file di Excel.

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Create a new workbook
    Workbook workbook;

    // Protect workbook structure with a password
    workbook.Protect(ProtectionType::Structure, u"password");

    // Save the workbook to a file
    workbook.Save(u"Book1.xlsx");

    std::cout << "Workbook created and protected successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}

Sblocca la Struttura del Workbook usando Aspose.Cells for C++

Sbloccare la struttura del workbook è semplice con l’API Aspose.Cells.

#include <iostream>
#include "Aspose.Cells.h"

using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Open an Excel file which workbook structure is protected.
    U16String inputFilePath = u"Book1.xlsx";
    Workbook workbook(inputFilePath);

    // Unprotect workbook structure.
    workbook.Unprotect(u"password");

    // Save Excel file.
    workbook.Save(inputFilePath);

    std::cout << "Workbook structure unprotected and saved successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}