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 the Aspose.Cells API. Please use Workbook.getAuthor() property for this purpose.

Specify Author while Write Protecting Workbook

The following sample code demonstrates 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 an output Excel file. The following screenshot illustrates the effect of the sample code on the output Excel file for your reference.

todo:image_alt_text

Sample Code

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

// Create an empty workbook.
const workbook = new AsposeCells.Workbook();

// Write-protect the workbook with a password.
workbook.getSettings().getWriteProtection().setPassword("1234");

// Specify the author while write-protecting the 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"));