document-builder
document-builder copied to clipboard
Document properties (title, subject, keywords, etc)
Adding document properties was much harder than expected, but I finally made it. I had to move code from WordDocument to WordDocumentBuilder and add relationships for app.xml and core.xml, and some other stuff.
In the document DSL you can now add a metadata
Map
like this:
document(font: [family: 'Arial', size: 12.pt],
metadata: [company: 'Groovy Documents Inc.',
manager: 'Craig Burke', author: 'Göran Ehrsson',
subject: 'Test', title: 'Test of document properties'],
Document metadata is currently stored in a Map
on Document
but maybe we should use a type DocumentMetadata
so we get strong typing and can validate metadata. Now that I've done both Word and PDF I can see that there is only a limited set of standard properties that can be set.
class DocumentMetadata {
String title
String subject
String description
String keywords
String author
String manager
String company
String category
String revision
Date created
Date modified
}