Обнаружение, заблокирован ли лист паролем, с помощью Node.js через C++

Contents
[ ]

Aspose.Cells for Node.js via C++ предоставляет свойство Protection.isProtectedWithPassword() для определения, защищён ли лист паролем или нет. Логическое свойство Protection.isProtectedWithPassword() возвращает true, если Worksheet защищён паролем, и false, если нет.

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