docxtpl is replacing my "&" in my word template with blanks. It is also not adding in the & from my Python code

119 Views Asked by At

#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
0

There are 0 best solutions below