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

3stack-software/python-docx

 
 

Repository files navigation

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.

About

Create and modify Word documents with Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 93.5%
  • Gherkin 6.4%
  • Other 0.1%