Closed dreizehnutters closed 1 year ago
When RichText elements are used with the highlight attributes, the generated document contains errors.
RichText
highlight
Fixing the xml properties seemed to produce correct documents.
Proof-of-Concept code:
from docxtpl import RichText, DocxTemplate tpl = DocxTemplate('poc.docx') YELLOW = 'ffe699' normal_string = 'Lorem ipsum dolor sit amet, consectetur adipisici elit' rich_string = 'String with a yellow highlight' rt_embedded = RichText(f'{rich_string}', highlight=YELLOW) context = { 'example' : rt_embedded, } tpl.render(context) tpl.save('richtext.docx')
current:
fixed:
🎉
When
RichText
elements are used with thehighlight
attributes, the generated document contains errors.Fixing the xml properties seemed to produce correct documents.
Proof-of-Concept code:
current:
fixed: