Skip to main content

An easy solution to design reports using OpenOffice

Project description

Introduction

py3o is an elegant and scalable solution to design reports using LibreOffice or OpenOffice. py3o.template is the templating component that takes care of merging your data sets with a corresponding templated OpenOffice document.

It is plateform independent and does not require LibreOffice/OpenOffice itself to generate an ODF file.

If you want to generate a PDF or any other supported output format you will then need to have a server with either LibreOffice or OpenOffice and to install the py3o.renderserver on it. We also provide a docker image on the docker hub

If you want to have templating fusion & document conversion in one single web service usable from any language with just HTTP/POST you can install py3o.fusion server. Which also exists as a docker image

Python 3 support

py3o.fusion is python3 ready. But, yes there is a but… alas!, you’ll need

to install a trunk version of Genshi:

$ # activate your python env...
$ svn checkout http://svn.edgewall.org/repos/genshi/trunk genshi_trunk
$ cd genshi_trunk
$ python setup.py build
$ python setup.py install

We tested this with revision 1271. When genshi 0.8 is released we can officially say we support Python3 out of the box.

Full Documentation

We provide a documentation for this package. If anything is not correctly explained, please! create a ticket in our ticketing system

Example Usage

Below is an example that you can find in the source code inside the examples directory.

from py3o.template import Template

t = Template("py3o_example_template.odt", "py3o_example_output.odt")

t.set_image_path('logo', 'images/new_logo.png')


class Item(object):
    pass

items = list()

item1 = Item()
item1.val1 = 'Item1 Value1'
item1.val2 = 'Item1 Value2'
item1.val3 = 'Item1 Value3'
item1.Currency = 'EUR'
item1.Amount = '12345.35'
item1.InvoiceRef = '#1234'
items.append(item1)

for i in xrange(1000):
    item = Item()
    item.val1 = 'Item%s Value1' % i
    item.val2 = 'Item%s Value2' % i
    item.val3 = 'Item%s Value3' % i
    item.Currency = 'EUR'
    item.Amount = '6666.77'
    item.InvoiceRef = 'Reference #%04d' % i
    items.append(item)

document = Item()
document.total = '9999999999999.999'

data = dict(items=items, document=document)
t.render(data)

Changelog

0.9 Jan. 8 2015

  • Added support for soft page breaks

0.8 Nov. 19 2014

  • Added better unit tests

  • Fixed corner cases in the variable introspection mechanism

  • Better handling of “ignore_undefined” that now also allows undefined images

0.7 Oct. 15 2014

  • Added Python3 support

  • Fixed a problem with validity of output in case the template contains a text:list inside a for loop

  • Added new public methods to help report servers introspect the template data dictionary

  • Added real unit tests (96% coverage ATM, way to go test team!)

Contributors

By order of contribution date:

Project details


Download files

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

Source Distributions

py3o.template-0.9.zip (19.3 kB view details)

Uploaded Source

py3o.template-0.9.tar.gz (12.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

py3o.template-0.9-py3.4.egg (26.2 kB view details)

Uploaded Egg

py3o.template-0.9-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file py3o.template-0.9.zip.

File metadata

  • Download URL: py3o.template-0.9.zip
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py3o.template-0.9.zip
Algorithm Hash digest
SHA256 b5dba50832955c4a978cfbd8be64be9deebe20673286b677b55af6a0c2784a66
MD5 be03d327b6e87afce15bcf4627c41044
BLAKE2b-256 d99c7aa3bd200e1a6f52e0dc5d3e6a650fb4e32d0fa83a4f05508e01b6ae0bf2

See more details on using hashes here.

File details

Details for the file py3o.template-0.9.tar.gz.

File metadata

  • Download URL: py3o.template-0.9.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py3o.template-0.9.tar.gz
Algorithm Hash digest
SHA256 2183426494ddf2d5a2d652cc193f8cc9b73b8b4dbfff47ef43d5de2404a5b88c
MD5 ea8910ca2d58a64ac708e4f6a734b64a
BLAKE2b-256 b8c90608f2663e877d5506f19ca889976e5b4ac202d6cd29c7479ec5f18e3c1c

See more details on using hashes here.

File details

Details for the file py3o.template-0.9-py3.4.egg.

File metadata

File hashes

Hashes for py3o.template-0.9-py3.4.egg
Algorithm Hash digest
SHA256 0df3ecca59caa7a2a0671038efa096723b32378013e71024db85de7405001b20
MD5 58cd2a20b81eee2de362d791be356ff0
BLAKE2b-256 08e742e573e84a6ee85033126e361d8bcb06a120aadc4e0d296e7fb7f464af22

See more details on using hashes here.

File details

Details for the file py3o.template-0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for py3o.template-0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 06099414ba592bd199c9d1e0d02c0ec44f7e1be872ad143bd05eb4836044b254
MD5 4fe7281ac739830b6b54a0726a1977e1
BLAKE2b-256 42cd5153f9a2b109946e8acbc7a092aaa3afb4e21e8dca9a2a79366c85ebaa64

See more details on using hashes here.

Supported by

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