ContentTypeProperties の操作

Aspose.Cells提供Workbook.ContentTypeProperties.Addカスタム ContentTypeProperties を Excel ファイルに追加するメソッド。を設定して、プロパティをオプションにすることもできます。ContentTypeProperty.IsNillableプロパティへ真実.次のコード スニペットは、オプションのカスタム ContentTypeProperties を Excel ファイルに追加する方法を示しています。次の図は、サンプル コードによって追加された両方のプロパティを示しています。

todo:画像_代替_文章

サンプル コードによって生成された出力ファイルを参照用に添付します。

出力ファイル

サンプルコード

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//source directory
string outputDir = RunExamples.Get_OutputDirectory();
Workbook workbook = new Workbook(FileFormatType.Xlsx);
int index = workbook.ContentTypeProperties.Add("MK31", "Simple Data");
workbook.ContentTypeProperties[index].IsNillable = false;
index = workbook.ContentTypeProperties.Add("MK32", DateTime.Now.ToString("yyyy-MM-dd'T'hh:mm:ss"), "DateTime");
workbook.ContentTypeProperties[index].IsNillable = true;
workbook.Save(outputDir + "WorkingWithContentTypeProperties_out.xlsx");