العمل مع خصائص نوع الوسائط

توفر Aspose.Cells طريقة Workbook.ContentTypeProperties.Add لإضافة خصائص نوع الوسائط المخصصة إلى ملف إكسل. يمكنك أيضًا جعل الخاصية اختيارية عن طريق تعيين الخاصية ContentTypeProperty.IsNillable إلى true . يوضح مقتطف الكود التالي إضافة خصائص نوع الوسائط المخصصة الاختيارية إلى ملف إكسل. تُظهر الصورة التالية كل الخصائص التي تمت إضافتها بواسطة مقتطف الكود.

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");