// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("A1").setValue("hello"); // Add a defined name. workbook.getNames().add("Headings", "=Sheet1!$A$1"); // Set values for built-in document properties workbook.getBuiltInDocumentProperties().setAuthor("Beryl"); workbook.getBuiltInDocumentProperties().setCompany("Company Name"); // Add a custom document property. IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("aaa", "Headings"); Object value = property.getValue(); // The value is "Hello". System.out.println(value); PropertyType type = property.getType(); // The Type is String. System.out.println(type); // Save to an excel file workbook.save("DocumentProperties.xlsx");
// Create a new workbook var workbook = Workbook() val worksheet: IWorksheet = workbook.getWorksheets().get(0) worksheet.getRange("A1").setValue("hello") // Add a defined name. workbook.getNames().add("Headings", "=Sheet1!\$A$1") // Set values for built-in document properties workbook.getBuiltInDocumentProperties().setAuthor("Beryl") workbook.getBuiltInDocumentProperties().setCompany("Company Name") // Add a custom document property. val property: IDocumentProperty = workbook.getCustomDocumentProperties().addLinkToContent("aaa", "Headings") val value: Any = property.getValue() // The value is "Hello". println(value) val type: PropertyType = property.getType() // The Type is String. System.out.println(type) // Save to an excel file workbook.save("DocumentProperties.xlsx")