0

#My code is as follows:

from docxtpl import DocxTemplate

adjective = "results & data-driven"

doc = DocXTemplate("Resume_Template.docx")

context = {'job_title': adjective}

doc.render(context)
doc.save("generated_resume.docx")

The above ampersand in "results & data-driven" shows up as a blank when it is generated. On top of that, any ampersand within my template, for example if I have "FP&A Manager" as job title resorts to "FP A Manager"

TL;DR The issue is becoming two fold:

  1. My "&"s are not transferring to my generated document
  2. any "&"s in my template are being being replaced with blanks or being left out
WQureshi
  • 19
  • 3
  • I found half of the answer, mainly to point 1. In order for it to be picked up into my docx file, I have to write in my python code or text that I want to be included as "&" wherever I want an ampersand. Still the issue of any existing ampersands in my word template being removed or replaced with a blank – WQureshi Jun 29 '23 at 16:45
  • Here's a link that might help answer you question. See the section on "Escaping" https://docxtpl.readthedocs.io/en/latest/ – Pragmatic_Lee Jun 29 '23 at 16:50

0 Answers0