Node.js kullanarak şifre koruması yapılan sayfayı doğrulama (C++ ile)
Contents
[
Hide
]
Aspose.Cells API’leri, Protection sınıfını çeşitli kullanışlı özellikler ve metodlar ile geliştirdi. Bu metodlardan biri, şifreyi bir string örneği olarak belirlemeye olanak tanıyan ve çalışma sayfasını korumak için kullanılan şifreyi doğrulayan Protection.verifyPassword(string) metodudur.
Protection.verifyPassword(string) metodu, belirttiğiniz şifre ile korunan çalışma sayfasının şifresi eşleşiyorsa true, eşleşmiyorsa false döner. Bu kod parçacığı, şifre koruma tespiti için Protection.verifyPassword(string) metodunu ve Protection.isProtectedWithPassword() özelliğini kullanır ve şifreyi doğrular.
const AsposeCells = require("aspose.cells.node");
const path = require("path");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "Sample.xlsx");
// Create an instance of Workbook and load a spreadsheet
const workbook = new AsposeCells.Workbook(filePath);
// Access the protected Worksheet
const sheet = workbook.getWorksheets().get(0);
// Check if Worksheet is password protected
if (sheet.getProtection().isProtectedWithPassword()) {
// Verify the password used to protect the Worksheet
if (sheet.getProtection().verifyPassword("1234")) {
console.log("Specified password has matched");
} else {
console.log("Specified password has not matched");
}
}