Ghostwriter icon indicating copy to clipboard operation
Ghostwriter copied to clipboard

Replace Jinja2 variables in Document Core Properties

Open domwhewell-sage opened this issue 1 year ago • 1 comments

This PR adds the ability to add jinja2 variables in the Document/PowerPoint properties (File > Info >> Properties). https://github.com/GhostManager/Ghostwriter/issues/389

You can add jinja2 variables into the Core properties in office documents so they will be replaced upon generation.

The properties dictionary in the _add_office_properties() function represents properties that can be accessed in both word and PowerPoint documents.

Whilst researching this I found there are some document properties in office documents that are not currently accessible to python-docx/python-pptx https://github.com/python-openxml/python-docx/issues/91 but hopefully this PR satisfies the basic properties.

domwhewell-sage avatar Feb 21 '24 10:02 domwhewell-sage

Thanks for submitting this! Due to the reporting engine undergoing a complete refactoring last month, we can't merge this as is. We'll need to adapt it for the new reporting library. If you'd like to tackle that, have a look at it here:

https://github.com/GhostManager/Ghostwriter/tree/v4-1-dev/ghostwriter/modules/reportwriter

That's part of the current release candidate. I'm giving it a couple more weeks for feedback. Barring any major issues, I expect to make it the final release the first week of April.

chrismaddalena avatar Mar 19 '24 19:03 chrismaddalena