Node.js経由でC++を使用し、ContentTypePropertiesの操作方法
Contents
[
Hide
]
Aspose.Cellsは、ExcelファイルにカスタムContentTypePropertiesを追加するための Workbook.getContentTypeProperties() メソッドを提供します。 ContentTypeProperty.isNillable() プロパティを true に設定することで、プロパティをオプションにすることも可能です。以下のコードスニペットは、オプションのカスタムContentTypePropertiesをExcelファイルに追加する例です。以下の画像は、サンプルコードで追加された両方のプロパティを示しています。
サンプルコードによって生成された出力ファイルが添付されています。
サンプルコード
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"));