Working with ContentTypeProperties with Node.js via C++

Contents
[ ]

Aspose.Cells provides Workbook.getContentTypeProperties() method to add custom ContentTypeProperties to an Excel file. You may also make the property optional by setting the ContentTypeProperty.isNillable() property to true. The following code snippet demonstrates adding optional custom ContentTypeProperties to an Excel file. The following image shows both properties that were added by the sample code.

todo:image_alt_text

The output file generated by the sample code is attached for reference.

Output File

Sample Code

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

//source directory
const outputDir = path.join(__dirname, "output");

const workbook = new AsposeCells.Workbook(AsposeCells.FileFormatType.Xlsx);
let index = workbook.getContentTypeProperties().add("MK31", "Simple Data");
workbook.getContentTypeProperties().get(index).setIsNillable(false);
index = workbook.getContentTypeProperties().add("MK32", new Date().toISOString(), "DateTime");
workbook.getContentTypeProperties().get(index).setIsNillable(true);
workbook.save(path.join(outputDir, "WorkingWithContentTypeProperties_out.xlsx"));