Specify Author while Write Protecting Workbook with Node.js via C++
Possible Usage Scenarios
You can specify an author name while write protecting your workbook using Aspose.Cells API. Please use Workbook.getAuthor() property for this purpose.
Specify Author while Write Protecting Workbook
The following sample code explains the usage of Workbook.getAuthor() property. The code creates an empty workbook, write protects it with a password, specifies the author name, and saves it as output Excel file. The following screenshot illustrates the effect of the sample code on the output Excel file for your reference.
Sample Code
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// Create empty workbook.
const workbook = new AsposeCells.Workbook();
// Write protect workbook with password.
workbook.getSettings().getWriteProtection().setPassword("1234");
// Specify author while write protecting workbook.
workbook.getSettings().getWriteProtection().setAuthor("SimonAspose");
// Save the workbook in XLSX format.
const outputDir = path.join(__dirname, "output");
workbook.save(path.join(outputDir, "outputSpecifyAuthorWhileWriteProtectingWorkbook.xlsx"));