Skip to content

Document properties (title, subject, keywords, etc)#39

Open
goeh wants to merge 20 commits intocraigburke:masterfrom
goeh:document-properties
Open

Document properties (title, subject, keywords, etc)#39
goeh wants to merge 20 commits intocraigburke:masterfrom
goeh:document-properties

Conversation

@goeh
Copy link
Copy Markdown
Contributor

@goeh goeh commented Feb 17, 2016

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'],

@goeh
Copy link
Copy Markdown
Contributor Author

goeh commented Feb 17, 2016

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants