Détecter si une feuille de calcul est protégée par mot de passe avec Node.js via C++

Contents
[ ]

Aspose.Cells for Node.js via C++ a exposé la propriété Protection.isProtectedWithPassword() pour détecter si une feuille de calcul est protégée par mot de passe ou non. La propriété de type booléen Protection.isProtectedWithPassword() retourne true si Worksheet est protégé par mot de passe et false sinon.

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// 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 book = new AsposeCells.Workbook(filePath);

// Access the protected Worksheet
const sheet = book.getWorksheets().get(0);

// Check if Worksheet is password protected
if (sheet.getProtection().isProtectedWithPassword()) {
console.log("Worksheet is password protected");
} else {
console.log("Worksheet is not password protected");
}