الكشف عما إذا كانت ورقة العمل محمية بكلمة مرور

Contents
[ ]

كشفت Aspose.Cells for Python via .NET عن الخاصية Protection.is_protected_with_password للكشف عما إذا كانت ورقة العمل محمية بكلمة مرور أم لا. الخاصية Protection.is_protected_with_password من نوع Boolean تُرجع true إذا كانت ورقة العمل محمية بكلمة مرور وfalse إذا لم تكن كذلك.

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")