Vérifiez si le projet VBA est protégé et verrouillé pour l'affichage
Contents
[
Hide
]
Scénarios d’utilisation possibles
Aspose.Cells vous permet de vérifier si le projet VBA (Visual Basic pour Applications) du fichier Excel est protégé et verrouillé pour la visualisation.
Exemple de code
L’exemple de code suivant charge leexemple de fichier Excel et vérifie si le projet VBA (Visual Basic pour Applications) du fichier Excel est protégé et verrouillé pour l’affichage. Veuillez également consulter sa sortie de console pour une référence.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(CheckifVBAProjectisProtectedandLockedforViewing.class) + "WorkbookVBAProject/"; | |
// Load your source Excel file. | |
Workbook wb = new Workbook(dataDir + "sampleCheckifVBAProjectisProtected.xlsm"); | |
// Access the VBA project of the workbook. | |
VbaProject vbaProject = wb.getVbaProject(); | |
// Whether "Lock project for viewing" is true or not. | |
System.out.println("Is VBA Project Locked for Viewing: " + vbaProject.getIslockedForViewing()); |
Sortie console
Il s’agit de la sortie console de l’exemple de code ci-dessus lorsqu’il est exécuté avec leexemple de fichier Excel.
Is VBA Project Locked for Viewing: true