if (!customproperties.contains("Test")) { customproperties.addProperty("Test", 123); CTProperty ctproperty = customproperties.getProperty("Test"); System.out.println(ctproperty); System.out.println(ctproperty.getI4()); if (!customproperties.contains("Test Date")) { customproperties.addProperty("Test Date", 0); ctproperty = customproperties.getProperty("Test Date"); ctproperty.unsetI4(); ctproperty.setFiletime(new GregorianCalendar(2016,1,13)); ctproperty = customproperties.getProperty("Test Date"); System.out.println(ctproperty); System.out.println(ctproperty.getFiletime());
StringBuffer text = new StringBuffer(); org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties props = getDocument().getProperties().getCustomProperties().getUnderlyingProperties();
/** * Add a new property * * @param name the property name * @throws IllegalArgumentException if a property with this name already exists */ private CTProperty add(String name) { if(contains(name)) { throw new IllegalArgumentException("A property with this name " + "already exists in the custom properties"); } CTProperty p = props.getProperties().addNewProperty(); int pid = nextPid(); p.setPid(pid); p.setFmtid(FORMAT_ID); p.setName(name); return p; }
private void extractMetadata(CustomProperties properties, Metadata metadata) { org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties props = properties.getUnderlyingProperties(); for (int i = 0; i < props.sizeOfPropertyArray(); i++) { CTProperty property = props.getPropertyArray(i);
custPart.getInputStream() ); cust = new CustomProperties(props); } else { custPart = null; cust = new CustomProperties((org.openxmlformats.schemas.officeDocument.x2006.customProperties.PropertiesDocument)NEW_CUST_INSTANCE.copy());
/** * Add a new boolean property * * @throws IllegalArgumentException if a property with this name already exists */ public void addProperty(String name, boolean value){ CTProperty p = add(name); p.setBool(value); }
/** * Add a new double property * * @throws IllegalArgumentException if a property with this name already exists */ public void addProperty(String name, double value){ CTProperty p = add(name); p.setR8(value); }
/** * Add a new string property * * @throws IllegalArgumentException if a property with this name already exists */ public void addProperty(String name, String value){ CTProperty p = add(name); p.setLpwstr(value); }
/** * Add a new integer property * * @throws IllegalArgumentException if a property with this name already exists */ public void addProperty(String name, int value){ CTProperty p = add(name); p.setI4(value); }