Metodo protect
Contenuti
[
Nascondere
]protect(self, type)
Protegge il foglio di lavoro.
def protect(self, type):
...
Parametro | Tipo | Descrizione |
---|---|---|
type | ProtectionType | Tipo di protezione. |
Osservazioni
Questo metodo protegge il foglio di lavoro senza password. Può essere utilizzato in tutte le versioni di Excel.
protect(self, type, password, old_password)
Protegge il foglio di lavoro.
def protect(self, type, password, old_password):
...
Parametro | Tipo | Descrizione |
---|---|---|
type | ProtectionType | Tipo di protezione. |
password | str | Password. |
old_password | str | Se il foglio di lavoro è già protetto da password, fornire la vecchia password. In caso contrario, è possibile impostare un valore nullo o una stringa vuota su questo parametro. |
Osservazioni
Questo metodo può essere utilizzato in tutte le versioni del foglio di lavoro Excel.
Esempio
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")
Guarda anche
- modulo
aspose.cells
- classe
Worksheet