الكشف عما إذا كانت ورقة العمل محمية بكلمة مرور
Contents
[
Hide
]
من الممكن حماية دفاتر العمل وورقات العمل بشكل منفصل. على سبيل المثال، قد تحتوي ورقة البيانات على واحدة أو أكثر من أوراق العمل المحمية بكلمة مرور، ومع ذلك، قد يكون دفتر العمل نفسه محميًا أو لا يكون. توفر واجهات برمجة Aspose.Cells for Python via .NET الوسائل للكشف عما إذا كانت ورقة العمل محمية بكلمة مرور أم لا. توضح هذه المقالة كيفية استخدام Aspose.Cells for Python via .NET لتحقيق ذلك.
كشفت Aspose.Cells for Python via .NET عن الخاصية Protection.is_protected_with_password للكشف عما إذا كانت ورقة العمل محمية بكلمة مرور أم لا. الخاصية Protection.is_protected_with_password من نوع Boolean تُرجع true إذا كانت ورقة العمل محمية بكلمة مرور وfalse إذا لم تكن كذلك.
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
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Create an instance of Workbook and load a spreadsheet | |
book = Workbook(dataDir + "sample.xlsx") | |
# Access the protected Worksheet | |
sheet = book.worksheets[0] | |
# Check if Worksheet is password protected | |
if sheet.protection.is_protected_with_password: | |
print("Worksheet is password protected") | |
else: | |
print("Worksheet is not password protected") |