Adding Custom Properties Visible Inside Document Information Panel with Node.js via C++

Adding Custom Properties Visible Inside Document Information Panel

Aspose.Cells for Node.js via C++ can be used to add custom properties to the workbook object, which are visible inside the Document Information Panel. You can open the Document Information Panel in Microsoft Excel using File > Info > Properties > Show Document Panel menu command.

Please use ContentTypePropertyCollection.add(string, string) method to add a custom property that will be visible in the Document Information Panel.

The following sample code adds two custom properties. The first property has no type, and the second property has a type of DateTime. Once you open the output Excel file generated by this code, you will see these two properties inside the Document Information Panel.

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

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");

// Create workbook object
const workbook = new AsposeCells.Workbook(AsposeCells.FileFormatType.Xlsx);

// Add simple property without any type
workbook.getContentTypeProperties().add("MK31", "Simple Data");

// Add date time property with type
workbook.getContentTypeProperties().add("MK32", "04-Mar-2015", "DateTime");

// Save the workbook
workbook.save(path.join(dataDir, "AddingCustomPropertiesVisible_out.xlsx"));

Related Article