Lavorare con ContentTypeProperties

Aspose.Cells fornisceWorkbook.ContentTypeProperties.Add per aggiungere ContentTypeProperties personalizzati a un file Excel. Puoi anche rendere facoltativa la proprietà impostando il fileContentTypeProperty.IsNillable proprietà aVERO. Il frammento di codice seguente illustra l’aggiunta di ContentTypeProperties personalizzati facoltativi a un file Excel. L’immagine seguente mostra entrambe le proprietà aggiunte dal codice di esempio.

cose da fare:immagine_alt_testo

Il file di output generato dal codice di esempio è allegato per riferimento.

File di uscita

Codice d’esempio

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