GhostManager / Ghostwriter

The SpecterOps project management and reporting engine
https://ghostwriter.wiki
BSD 3-Clause "New" or "Revised" License
1.31k stars 181 forks source link

Replace Jinja2 variables in Document Core Properties #397

Closed domwhewell-sage closed 3 months ago

domwhewell-sage commented 7 months ago

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.

chrismaddalena commented 6 months ago

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.