VBA Projesinin Korumalı olup olmadığını öğrenin
Contents
[
Hide
]
Olası Kullanım Senaryoları
Excel dosyanızın VBA (Visual Basic Applications) Projesinin korumalı olup olmadığını Aspose.Cells ile öğrenebilirsiniz.VbaProject.isProtected()yöntem
Basit kod
Aşağıdaki örnek kod, bir çalışma kitabı oluşturur ve ardından VBA projesinin korunup korunmadığını kontrol eder. Daha sonra VBA projesini korur ve yine VBA projesinin korunup korunmadığını kontrol eder. Lütfen referans için konsol çıktısına bakın. Koruma öncesi,VbaProject.isProtected() İadelerYANLIŞ ancak korumadan sonra geri dönerdoğru.
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 | |
// Create a workbook. | |
Workbook wb = new Workbook(); | |
// Access the VBA project of the workbook. | |
VbaProject vbaProj = wb.getVbaProject(); | |
// Find out if VBA Project is Protected using IsProtected property. | |
System.out.println("IsProtected - Before Protecting VBA Project: " + vbaProj.isProtected()); | |
// Protect the VBA project. | |
vbaProj.protect(true, "11"); | |
// Find out if VBA Project is Protected using IsProtected property. | |
System.out.println("IsProtected - After Protecting VBA Project: " + vbaProj.isProtected()); |
Konsol Çıkışı
Bu, referans için yukarıdaki örnek kodun konsol çıktısıdır.
IsProtected - Before Protecting VBA Project: false
IsProtected - After Protecting VBA Project: true