Vérifiez si le projet VBA est protégé avec Node.js via C++
Vérifiez si le projet VBA est protégé dans Node.js
Vous pouvez déterminer si le projet VBA (Visual Basic Applications) de votre fichier Excel est protégé ou non avec Aspose.Cells en utilisant la propriété VbaProject.isProtected().
Code d’exemple
Le code exemple suivant crée un classeur puis vérifie si son projet VBA est protégé ou non. Ensuite, il protège le projet VBA et vérifie de nouveau. Veuillez consulter la sortie de la console pour référence. Avant la protection, VbaProject.isProtected() retourne faux, mais après, il retourne vrai.
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());
Sortie console
Il s’agit de la sortie console du code d’exemple ci-dessus pour référence.
IsProtected - Before Protecting VBA Project: False
IsProtected - After Protecting VBA Project: True