Skip to content

Commit

Permalink
Update index.rst
Browse files Browse the repository at this point in the history
Updating 'sub-document' documentation to make explicit what was already implicit.
  • Loading branch information
jkpet authored Jul 19, 2024
1 parent d322120 commit 0642bad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0642bad

Please sign in to comment.