public static void main(String[]args) throws Exception {
XSSFWorkbook workbook = new XSSFWorkbook();
workbook.createSheet("Workbook Properties");
POIXMLProperties props = workbook.getProperties();
/**
* Extended properties are a predefined set of metadata properties
* that are specifically applicable to Office Open XML documents.
* Extended properties consist of 24 simple properties and 3 complex properties stored in the
* part targeted by the relationship of type
*/
POIXMLProperties.ExtendedProperties ext = props.getExtendedProperties();
ext.getUnderlyingProperties().setCompany("Apache Software Foundation");
ext.getUnderlyingProperties().setTemplate("XSSF");
/**
* Custom properties enable users to define custom metadata properties
* through a set of well-defined data types. For example, a custom
* OLE Editor property of type string can be defined as follows:
*
* <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="Editor">
* <vt:lpwstr>John Smith</vt:lpwstr>
* </property>
*/
POIXMLProperties.CustomProperties cust = props.getCustomProperties();
org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty
property = cust.getUnderlyingProperties().addNewProperty();
property.setFmtid("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}");
property.setPid(2);