https://github.com/puria/tgext.odt
tgextodt is a Pluggable application for TurboGears2 that allows the rendering of .odt (openoffice/libreoffice) documents as an output templates.
https://github.com/puria/tgext.odt
Last synced: 2 months ago
JSON representation
tgextodt is a Pluggable application for TurboGears2 that allows the rendering of .odt (openoffice/libreoffice) documents as an output templates.
- Host: GitHub
- URL: https://github.com/puria/tgext.odt
- Owner: puria
- License: unlicense
- Created: 2013-12-05T23:32:31.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-02-07T16:46:26.000Z (over 7 years ago)
- Last Synced: 2025-03-24T11:56:54.976Z (3 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
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**, then at the *end of the file* call plug with tgextodt::
from tgext.pluggable import plug
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):
response.headerlist.append(('Content-Disposition', 'attachment;filename=filename.odt'))
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**