Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Latest commit

 

History

History
27 lines (20 loc) · 1.07 KB

README.rst

File metadata and controls

27 lines (20 loc) · 1.07 KB
https://travis-ci.org/python-openxml/python-docx.svg?branch=master

python-docx is a Python library for creating and updating Microsoft Word (.docx) files.

More information is available in the python-docx documentation.

This fork adds a proof of concept for using docx documents as templates. Two templating engines (django and jinja) are supported. Template instructions can be written directly in Word or handcrafted in the document.xml If written in Word, Block-Level tags must have a style named "TEMPLATE_BLOG" attached. Color, font, etc. of TEMPLATE_BLOG are left to your liking (I use Courier, Green, 4pt). Usage is simple:

`python from docx import Document d = Document("in.docx") d.save( "out.docx", {'name':"Holli"}, "jinja" ) `

will replace every instance of the text {{ name }} in in.docx with "Holli" and saves it to out.docx

For more information about template languages see the respective engine documentation.