Detectar si la hoja de cálculo está protegida con contraseña usando Node.js vía C++

Contents
[ ]

Aspose.Cells for Node.js via C++ ha expuesto la propiedad Protection.isProtectedWithPassword() para detectar si una hoja de cálculo está protegida con contraseña o no. La propiedad de tipo Boolean Protection.isProtectedWithPassword() devuelve true si Worksheet está protegida con contraseña y false si no.

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");
}