Using WorkbookMetadata with Node.js via C++
Contents
[
Hide
]
Aspose.Cells allows you to load a light-weight version of a workbook into memory to edit its metadata information. Please use the WorkbookMetadata class to load the workbook.
The following sample code uses the WorkbookMetadata class to edit custom document properties of a workbook. Once you open the workbook using the Workbook class, you will be able to read the document properties. Here is a sample code using the WorkbookMetadata class.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Open Workbook metadata
const options = new AsposeCells.MetadataOptions(AsposeCells.MetadataType.Document_Properties);
const meta = new AsposeCells.WorkbookMetadata(path.join(dataDir, "Sample1.xlsx"), options);
// Set some properties
meta.getCustomDocumentProperties().add("test", "test");
// Save the metadata info
meta.save(path.join(dataDir, "Sample2.out.xlsx"));
// Open the workbook
const w = new AsposeCells.Workbook(path.join(dataDir, "Sample2.out.xlsx"));
// Read document property
console.log(w.getCustomDocumentProperties().get("test"));
console.log("Press any key to continue...");