Ermitteln, ob das VBA Projekt mit Node.js via C++ geschützt ist

Ermitteln, ob das VBA-Projekt in Node.js geschützt ist

Sie können feststellen, ob das VBA (Visual Basic for Applications) Projekt Ihrer Excel-Datei mit Aspose.Cells mit VbaProject.isProtected()-Eigenschaft geschützt ist.

Beispielcode

Der folgende Beispielcode erstellt eine Arbeitsmappe und überprüft, ob ihr VBA-Projekt geschützt ist oder nicht. Dann schützt er das VBA-Projekt und überprüft erneut, ob das VBA-Projekt geschützt ist oder nicht. Bitte sehen Sie sich die Konsolenausgabe zur Referenz an. Vor dem Schutz gibt VbaProject.isProtected() false zurück, nach dem Schutz gibt es true zurück.

const AsposeCells = require("aspose.cells.node");

// Create a workbook.
const wb = new AsposeCells.Workbook();

// Access the VBA project of the workbook.
const vbaProj = wb.getVbaProject();

// Find out if VBA Project is Protected using isProtected method.
console.log("IsProtected - Before Protecting VBA Project: " + vbaProj.isProtected());

// Protect the VBA project.
vbaProj.protect(true, "11");

// Find out if VBA Project is Protected using isProtected method.
console.log("IsProtected - After Protecting VBA Project: " + vbaProj.isProtected());

Konsolenausgabe

Dies ist die Konsolenausgabe des obigen Beispielcodes als Referenz.

IsProtected - Before Protecting VBA Project: False

IsProtected - After Protecting VBA Project: True