You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on a custom docx template for a specific class of documents I will need to regularly generate, converting from markdown to docx. I first manually created the template file with some dummy data, extracted the docx to zip format and copied the document.xml file into my working directory.
After introducing some metadata variables in the document.xml and compiling my input markdown file, it looks like they are being interpolated and formatted properly. However, it turns out that my template contains about 3 images, 2 of which will need to change for every instance of the document class I create. Ideally I would like to be able to provide relative paths to these images in my metadata as follows:
---metadata_var1: "Value1"metadata_var2: "Value2"img_file_path: "my/image/path.jpg"---
SOme content
However it looks like this is harder to do, considering that OpenXML seems to prefer adding media to the document.xml using relationship IDs.
Is there support for adding paths to image files via metadata variables for docx templates? If not has anyone ever run into a similar problem and found a workaround?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently working on a custom docx template for a specific class of documents I will need to regularly generate, converting from markdown to docx. I first manually created the template file with some dummy data, extracted the docx to zip format and copied the
document.xml
file into my working directory.After introducing some metadata variables in the
document.xml
and compiling my input markdown file, it looks like they are being interpolated and formatted properly. However, it turns out that my template contains about 3 images, 2 of which will need to change for every instance of the document class I create. Ideally I would like to be able to provide relative paths to these images in my metadata as follows:However it looks like this is harder to do, considering that OpenXML seems to prefer adding media to the document.xml using relationship IDs.
Is there support for adding paths to image files via metadata variables for docx templates? If not has anyone ever run into a similar problem and found a workaround?
Beta Was this translation helpful? Give feedback.
All reactions