protect yöntemi

protect(self, type)

Çalışma sayfasını korur.


def protect(self, type):
    ...
ParametreTipTanım
typeProtectionTypeKoruma türü.

Notlar

Bu yöntem, çalışma sayfalarını şifresiz olarak korur. protect çalışma sayfası Excel dosyasının tüm versiyonlarında kullanılabilir.

protect(self, type, password, old_password)

Çalışma sayfasını korur.


def protect(self, type, password, old_password):
    ...
ParametreTipTanım
typeProtectionTypeKoruma türü.
passwordstrŞifre.
old_passwordstrEğer çalışma sayfası zaten bir parola ile korunuyorsa lütfen eski parolayı girin.
Aksi takdirde bu parametreye null değer veya boş bir dize atayabilirsiniz.

Notlar

Bu yöntem protect çalışma sayfasını Excel dosyasının tüm versiyonlarında çalıştırabilir.

Örnek

from aspose.cells import ProtectionType, Workbook

# Instantiating a Workbook object
excel = Workbook("template.xlsx")
# Accessing the first worksheet in the Excel file
worksheet = excel.worksheets[0]
# Protecting the worksheet with a password
worksheet.protect(ProtectionType.ALL, "aspose", None)
# Saving the modified Excel file in default (that is Excel 20003) format
excel.save("output.xls")

Ayrıca bakınız