Kontrollera om VBA-projektet är skyddat och låst för visning
Contents
[
Hide
]
Möjliga användningsscenarier
Aspose.Cells låter dig kontrollera om VBA-projektet (Visual Basic for Applications) Excel-filen är skyddad och låst för visning.
Exempelkod
Följande exempelkod laddarexempel på Excel-fil och kontrollerar om VBA (Visual Basic for Applications) Project of Excel-fil är skyddad och låst för visning. Se även dess konsolutgång för en referens.
This file contains hidden or 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()); |
Konsolutgång
Detta är konsolutgången för ovanstående exempelkod när den körs med den medföljandeexempel på Excel-fil.
Is VBA Project Locked for Viewing: true