Templated-docs generates templated documents in any format supported by LibreOffice
Project description
Generate templated documents within Django in any format supported by LibreOffice: texts, spreadsheets, presentations etc.
Free software: MIT license
Documentation: https://templated-docs.readthedocs.io.
Requirements
Django >= 1.8
A recent LibreOffice version (>=4.3.0) supporting LibreOfficeKit API.
Pylokit library to bridge to LibreOffice
Example usage
Create a sample.odt document (make sure it’s in OpenDocument format) and put it in your Django templates folder. It should look something like this:
Then write a view to generate documents from this template:
from templated_docs import fill_template from templated_docs.http import FileResponse def get_document(request): """ A view to get a document filled with context variables. """ context = {'user': request.user} # Just an example filename = fill_template('sample.odt', context, output_format='pdf') visible_filename = 'greeting.pdf' return FileResponse(filename, visible_filename)
Navigate to the url your view is connected to, and you’ll see a rendered and converted document:
For more examples, see the examples/ subfolder in the repository. More detailed documentation is available on https://templated-docs.readthedocs.io.
Credits
Templated-docs was written by Alex Morozov.
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
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
Built Distribution
Hashes for templated_docs-0.2.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e71440b8da800ee29729768cd1614f8089f234358a178d2c52b5ae5b1b1757b |
|
MD5 | 22632d91ea58fbb31314af3d4c6c341a |
|
BLAKE2b-256 | f63d07bf1e3796f6b405adcfdd03af705fa274170c7c3a0eff768637421c7262 |