From 2886a851e03d319935477dc5f7bf4040a807d332 Mon Sep 17 00:00:00 2001 From: Bart Broere Date: Tue, 17 Sep 2024 21:07:21 +0200 Subject: [PATCH] Change the XML library to lxml to avoid namespace renaming and other XML problems --- docxtpl/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docxtpl/template.py b/docxtpl/template.py index b421e64..20bfb4d 100644 --- a/docxtpl/template.py +++ b/docxtpl/template.py @@ -359,7 +359,7 @@ def render_footnotes( for k, v in self.docx.sections[0].part.related_parts.items(): if v.content_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml': - import xml.etree.ElementTree as ET + from lxml import etree as ET tree = ET.fromstring(v.blob) for footnote in tree.findall('.//w:t', docx.oxml.ns.nsmap): if hasattr(footnote, 'text'):