From 5ee1c034108849d1409008fdbd166ab63adb73ae Mon Sep 17 00:00:00 2001 From: Eric Lapouyade Date: Mon, 11 May 2020 17:55:53 +0200 Subject: [PATCH] fix get_undeclared_template_variables() to include header/footer --- docxtpl/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docxtpl/__init__.py b/docxtpl/__init__.py index d202e8f..72755ce 100644 --- a/docxtpl/__init__.py +++ b/docxtpl/__init__.py @@ -609,6 +609,9 @@ class DocxTemplate(object): def get_undeclared_template_variables(self, jinja_env=None): xml = self.get_xml() xml = self.patch_xml(xml) + for uri in [self.HEADER_URI, self.FOOTER_URI]: + for relKey, _xml in self.get_headers_footers_xml(uri): + xml += self.patch_xml(_xml) if jinja_env: env = jinja_env else: