From 0642badebc6f6ee4356660d73bbfc4922f45eb10 Mon Sep 17 00:00:00 2001 From: jkpet <60282159+jkpet@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:03:07 +1000 Subject: [PATCH] Update index.rst Updating 'sub-document' documentation to make explicit what was already implicit. --- docs/index.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index e54c757..517c3e8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -288,6 +288,16 @@ calling method `new_subdoc()` :: tpl = DocxTemplate('templates/merge_docx_master_tpl.docx') sd = tpl.new_subdoc('templates/merge_docx_subdoc.docx') + context = { + 'mysubdoc': sd, + } + + tpl.render(context) + tpl.save('output/merge_docx.docx') + +In the above example, the content of 'templates/merge_docx_subdoc.docx' will be inserted into the parent document in place of the declared +variable `{{ mysubdoc }}`. + See `tests/merge_docx.py` for full code. .. _Escaping: