Değiştirmek için Parola Kontrolü Aspose.Cells for Python via .NET ile
Microsoft Excel’de Değiştirme Şifresini Kontrol Etme
Microsoft Excel’de çalışma kitapları oluştururken Açma Şifresi ve Değiştirme Şifresi atayabilirsiniz. Bu şifreleri belirlemek için Microsoft Excel’in sağladığı arayüzü gösteren bu ekran görüntüsüne bakınız.
![]() |
---|
Değiştirmek için Parola Kontrolü Aspose.Cells for Python via .NET ile
Aşağıdaki örnek kod, kaynak Excel dosyasını yükler. Dosyanın Açma Şifresi 1234 ve Değiştirme Şifresi 5678’dir. Kod önce 567’nin doğru Değiştirme Şifresi olup olmadığını kontrol eder ve yanlış döndürür, ardından 5678’in Değiştirme Şifresi olup olmadığını kontrol eder ve doğru döndürür.
from aspose.cells import LoadOptions, 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(".") | |
# Specify password to open inside the load options | |
opts = LoadOptions() | |
opts.password = "1234" | |
# Open the source Excel file with load options | |
workbook = Workbook(dataDir + "sampleBook.xlsx", opts) | |
# Check if 567 is Password to modify | |
ret = workbook.settings.write_protection.validate_password("567") | |
print("Is 567 correct Password to modify: " + str(ret)) | |
# Check if 5679 is Password to modify | |
ret = workbook.settings.write_protection.validate_password("5678") | |
print("Is 5678 correct Password to modify: " + str(ret)) |
Konsol Çıktısı
Yukarıdaki örnek kodun kaynak Excel dosyasını yükledikten sonraki Konsol Çıkışı burada.
Is 567 correct Password to modify: False
Is 5678 correct Password to modify: True