Arbeta med ContentTypeProperties
Contents
[
Hide
]
Aspose.Cells tillhandahållerWorkbook.ContentTypeProperties.Add metod för att lägga till anpassade ContentTypeProperties till en excel-fil. Du kan också göra egenskapen valfri genom att ställa inContentTypeProperty.IsNillable egendom tillSann. Följande kodavsnitt visar hur man lägger till valfria anpassade ContentTypeProperties till en excel-fil. Följande bild visar båda egenskaperna som lades till av exempelkoden.
Utdatafilen som genereras av exempelkoden bifogas som referens.
Exempelkod
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"); |