Skip to main content

Simple Open Document Text templating tool

Project description

This is a minimal module for creating ODT files based on ODT templates and dictionaries of values.

Note that the template rendering is based on regular expression matches on the ODT internal XML data; as such it should not be considered robust and will most certainly fail on some inputs. However, it’s “good enough” to be very useful considering the tiny code footprint - there are more lines of documentation than code here!

Just be sure to test your templates…


from odt_template import render_odt_template

# Assuming a template that has:
#   - A @TO@ marker somewhere on the page
#   - A table with a row containing @CHILD@ and @NAUGHTY@ markers
#   - An embedded image named XMAS.png
render_odt_template('xmas-template.odt', 'simpsons-family.odt', {
    'to': 'Santa Claus',
    'child': [
        {'child': 'Bart', 'naughty': 'yes'},
        {'child': 'Lisa', 'naughty': 'no'},
        {'child': 'Maggie', 'naughty': 'no'}
    'Pictures/XMAS.png': open('pretty-tree.png', 'r').read()

Contributions and bug reports

Please file pull requests or open issues on this project’s Github repository:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odt_templater-0.1.1.tar.gz (3.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page