ContentTypeProperties の操作
Contents
[
Hide
]
Aspose.Cells提供Workbook.ContentTypeProperties.Add メソッドを使用して、カスタム ContentTypeProperties を Excel ファイルに追加します。を設定して、プロパティをオプションにすることもできます。ContentTypeProperty.IsNillableプロパティへ真実.次のコード スニペットは、オプションのカスタム ContentTypeProperties を Excel ファイルに追加する方法を示しています。次の図は、サンプル コードによって追加された両方のプロパティを示しています。
サンプル コードによって生成された出力ファイルを参照用に添付します。
サンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |