تحقق مما إذا كان VBA Project محميًا ومؤمنًا للعرض
Contents
[
Hide
]
تحقق مما إذا كان مشروع VBA محميًا ومغلقًا للعرض في C#
يسمح لك Aspose.Cells بالتحقق مما إذا كان ملف VBA (Visual Basic for Applications) Project of Excel محميًا ومغلقًا للعرض. لهذا ، يوفر API الامتدادVbaProject.slockedForViewing خاصية. إذا تم قفله للعرض ، فإن ملفVbaProject.slockedForViewing إرجاع الممتلكاتحقيقي.
عينة من الرموز
يقوم نموذج التعليمات البرمجية التالي بتحميل ملفنموذج لملف Excel ويتحقق مما إذا كان ملف VBA (Visual Basic for Applications) Project of Excel محميًا ومؤمنًا للعرض. يرجى أيضًا الاطلاع على إخراج وحدة التحكم الخاص به للحصول على مرجع.
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-.NET | |
//The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
//Load your source Excel file. | |
Workbook wb = new Workbook(dataDir + "sampleCheckifVBAProjectisProtected.xlsm"); | |
//Access the VBA project of the workbook. | |
Aspose.Cells.Vba.VbaProject vbaProject = wb.VbaProject; | |
//Whether "Lock project for viewing" is true or not. | |
Console.WriteLine("Is VBA Project Locked for Viewing: " + vbaProject.IslockedForViewing); |
إخراج وحدة التحكم
هذا هو إخراج وحدة التحكم لنموذج التعليمات البرمجية أعلاه عند تنفيذه مع المتوفرنموذج لملف Excel.
Is VBA Project Locked for Viewing: True