drmacro / wordinator

Generate high-quality DOCX files using a simplified XML format (simple word processing XML).
Apache License 2.0
38 stars 8 forks source link

Set document properties #140

Closed ekimbernow closed 7 months ago

ekimbernow commented 7 months ago

Enable ability to set the properties of the document.

These are stored in the docProps/core.xml, docProps/app.xml, and docProps/custom.xml files.

The properties can be accessed like so:

 XWPFDocument doc = new XWPFDocument();
 POIXMLProperties props = doc.getProperties();
ekimbernow commented 7 months ago

This seems to work and there do appear to be set methods for all the properties:

    POIXMLProperties props = doc.getProperties();    
    Optional<java.util.Date> date = Optional.of(new Date());
    props.getCoreProperties().setCreated(date);