From d2037d2a541ef02ba95e3707569c63c1d612e281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20**Felix**=20H=C3=A4berle?= Date: Wed, 22 Dec 2021 18:49:35 +0100 Subject: [PATCH] added interface function to check variables in document --- docs/index.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 42e640a..29835f3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -78,6 +78,17 @@ Use instead:: {{ myvariable }} {% if something %} +Get Defined Variables ++++++++++++++++++++++ + +In order to get the missing variables after rendering use :: + + tpl=DocxTemplate('your_template.docx') + tpl.render(context_dict) + set_of_variables = tpl.get_undeclared_template_variables() + +**IMPORTANT** : You may use the method before rendering to get a set of keys you need, e.g. to be prompted to a user or written in a file for manual processing. + Extensions ++++++++++