Lavorare con ContentTypeProperties

Aspose.Cells fornisceWorkbook.ContentTypeProperties.Add metodo 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-.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");