VBA プロジェクトが保護され、表示用にロックされているかどうかを確認する
Contents
[
Hide
]
考えられる使用シナリオ
Aspose.Cells では、Excel ファイルの VBA (Visual Basic for Applications) プロジェクトが保護され、表示のためにロックされているかどうかを確認できます。
サンプルコード
次のサンプル コードは、サンプル Excel ファイルまた、Excel ファイルの VBA (Visual Basic for Applications) プロジェクトが保護され、表示のためにロックされているかどうかを確認します。参照用にコンソール出力も参照してください。
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()); |
コンソール出力
これは、上記のサンプル コードを提供されたコマンドで実行したときのコンソール出力です。サンプル Excel ファイル.
Is VBA Project Locked for Viewing: true