Verifica password dei file crittografati
Contents
[
Hide
]
Se i file Excel (xlsx, xlsb, xls, xlsm) e i file Open office (ODS) sono bloccati da password, Aspose supporta una semplice verifica della password senza l’analisi di dati specifici dei file.
Verifica la password del file crittografato
Per verificare la password del file criptato, Aspose.Cells per Python via .NET offre il metodo verify_password. Questi metodi accettano due parametri, il flusso del file e la password da verificare. Il seguente frammento di codice dimostra l’uso del metodo verify_password per verificare se la password fornita è valida o meno.
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 FileFormatUtil | |
# 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 a Stream object | |
fstream = open(dataDir + "EncryptedBook1.xlsx", "rb") | |
isPasswordValid = FileFormatUtil.verify_password(fstream, "1234") | |
print("Password is Valid: " + str(isPasswordValid)) |