Alan Evangelista 63cd4c31f7 Also look for title and description when replacing pictures
Before, the only searched picture tag was 'name', which corresponds to the file
name of the image added to the docx. Also searching in title and description tags
makes creating docx templates to be rendered by this more flexible and easier
in document editors which do not support viewing the image's original filename,
such as Google Docs.

Also, picture replacement was comprised of picture map creation and picture
replacing. Both processes were merged in order to implement the above change
more easily.
2021-05-05 18:21:42 -03:00
2018-11-18 17:56:14 +01:00
2015-03-13 11:59:50 +01:00
2015-03-13 11:59:50 +01:00
2015-03-12 18:13:24 +01:00
2018-04-20 18:35:14 +02:00
2020-11-09 09:22:33 +01:00
2020-11-09 09:22:33 +01:00
2020-04-29 14:41:27 +02:00
2021-01-09 13:56:38 +01:00

====================
python-docx-template
====================

Use a docx as a jinja2 template

Introduction
------------

This package uses 2 major packages :

- python-docx for reading, writing and creating sub documents
- jinja2 for managing tags inserted into the template docx

python-docx-template has been created because python-docx is powerful for creating documents but not for modifying them.

The idea is to begin to create an example of the document you want to generate with microsoft word, it can be as complex as you want :
pictures, index tables, footer, header, variables, anything you can do with word.
Then, as you are still editing the document with microsoft word, you insert jinja2-like tags directly in the document.
You save the document as a .docx file (xml format) : it will be your .docx template file.

Now you can use python-docx-template to generate as many word documents you want from this .docx template and context variables you will associate.

Share
-----

If you like this project, please rate and share it here : http://rate.re/github/elapouya/python-docx-template

Documentation
-------------

Please, `read the doc <http://docxtpl.readthedocs.org>`_

Other projects
--------------

Have a look at some of my other projects :

- `python-textops3 <https://github.com/elapouya/python-textops3>`_ : Chainable text operations
- `django-robohash-svg <https://github.com/elapouya/django-robohash-svg>`_ : Create svg robots avatars

Description
Use a docx as a jinja2 template
Readme 4.8 MiB
Languages
Python 100%