Lavorare con ContentTypeProperties
Contents
[
Hide
]
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.
Il file di output generato dal codice di esempio è allegato per riferimento.
Codice d’esempio
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"); |