Arbeitsmappe Struktur mit C++ schützen und entsperren
Contents
[
Hide
]
Um zu verhindern, dass andere Benutzer versteckte Arbeitsblätter einsehen, Arbeitsblätter hinzufügen, verschieben, löschen oder ausblenden und Arbeitsblätter umbenennen, können Sie die Struktur Ihres Excel-Arbeitsblatts mit einem Kennwort schützen.
Arbeitsmappe-Struktur in MS Excel schützen und entsperren
- Klicken Sie auf Überprüfen > Arbeitsmappe schützen.
- Geben Sie ein Passwort in das Passwortfeld ein.
- Wählen Sie OK, geben Sie das Passwort erneut ein, um es zu bestätigen, und wählen Sie dann erneut OK.
Arbeitsmappe-Struktur mit {Aspose.Cells for C++} schützen
Es sind nur die folgenden einfachen Codezeilen erforderlich, um die Arbeitsmappenstruktur von Excel-Dateien zu schützen.
#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();
}
Arbeitsmappe-Struktur mit {Aspose.Cells for C++} entsperren
Die Entschützung der Arbeitsmappenstruktur ist mit der Aspose.Cells API einfach.
#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();
}
Hinweis: Ein korrektes Passwort ist erforderlich.