tgext.odt is a Pluggable application for TurboGears2 that allows the rendering of .odt (openoffice/libreoffice) documents as an output templates.
Project description
About tgextodt
tgextodt is a Pluggable application for TurboGears2 that allows the rendering of .odt (openoffice/libreoffice) documents as an output templates.
Installing
tgextodt can be installed both from pypi or from bitbucket:
pip install tgextodt
should just work for most of the users
Plugging tgextodt
In your application config/app_cfg.py import plug:
from tgext.pluggable import plug
Then at the end of the file call plug with tgextodt:
plug(base_config, 'tgextodt')
Usage
To use an odt template you have to declare the type in your controller as below:
@expose('odt:example.templates.about', content_type='application/vnd.oasis.opendocument.text') def about(self): return dict(hello='Hello World')
obviously in your example application in the folder example/templates you should provide a templated named about.odt in wich you have defined the variable field py3o.document.hello.
To define a variable field in libreoffice you can dig more information on https://help.libreoffice.org/Writer/Variables basically from the menu Insert -> Fields -> Other -> Variables
For more complex features, like for loops and more detailed reporting stuff, you want to read the documentation of the py3o library itself http://py3otemplate.readthedocs.org/
Now you can directly download your output from /about or /about.odt
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file tgext.odt-0.1a.tar.gz
.
File metadata
- Download URL: tgext.odt-0.1a.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c770b297f8590603ba56e00847b62f0029d26c4538c2b4fe005f5b54f5a1e2d1 |
|
MD5 | be88448cb043d0f1f062886a48c0aa62 |
|
BLAKE2b-256 | 1ca18b1050433d44be2e4fc7db2ab59b340baa134e6c41a84ae192baef1dffd5 |