ContentTypePropertiesの操作

Aspose.Cellsは、ExcelファイルにカスタムContentTypePropertiesを追加するためのWorkbook.ContentTypeProperties.Addメソッドを提供しています。また、trueに設定することでプロパティを任意にすることもできます。以下のコードスニペットは、Excelファイルに任意のカスタムContentTypePropertiesを追加する方法を示しています。以下の画像は、サンプルコードによって追加された両方のプロパティを示しています。

todo:image_alt_text

サンプルコードによって生成された出力ファイルが添付されています。

出力ファイル

サンプルコード

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the directories.
String outputDir = Utils.Get_OutputDirectory();
Workbook workbook = new Workbook(FileFormatType.XLSX);
int index = workbook.getContentTypeProperties().add("MK31", "Simple Data");
workbook.getContentTypeProperties().get(index).setNillable(false);
index= workbook.getContentTypeProperties().add("MK32", "2019-10-17T16:00:00+00:00", "DateTime");
workbook.getContentTypeProperties().get(index).setNillable(false);
workbook.save(outputDir + "WorkingWithContentTypeProperties_out.xlsx");