Howto: Make RML templates from Openoffice.org ODT files
Report Markup Language (RML) is the ReportLAB and Open ERP format for pdf reports. It’s an XML format and it can be easy generated from web application, such as Django. Satchmo uses rml templates for shipping labels, invoices and packing slip.
One way to generate those templates it to write by hand the XML, with some difficult actions needed to generate tables and complex items.
Another easy way is to use OpenOffice.org to make the template.
The procedure is quite simple and we’ll explain it here.
First of all, generate a text odt document. If you use tables, make sure to have the same number of column for every rows. If you need a more complicated table, split it in different tables or good results will be difficult to achieve.
Format the page dimensions with openoffice, it will be the same on pdf.
In your template you must be sure to put also the text you will change, to format it to your needs. To use it in a django app, you can use the django template system placeholders like {{name}} or {{address}}.
Then, save it and use Tiny SXW2RML to transform it to RML.
./tiny_sxw2rml.py template.odt > template.rml
You can use python-trml2pdf to see the results:
apt-get install python-trml2pdf
and then
trml2pdf template.rml > template.pdf
If it’s good, you can simply replace placeholders with the text of your report (or packing slip, as we’ve done) and then generate your pdf. Using them on django apps makes RML a very good choice to generate automatically documents from databases and web apps.
Tag: databases, django, markup language, odt files, openoffice, packing slip, page dimensions, placeholders, python, rml, Satchmo, shipping labels, templates, xml format






aprile 7th, 201008:50 at
great! Thanks your tip and post!!
agosto 29th, 201014:39 at
Fed up with obtaining low amounts of useless traffic to your website? Well i wish to tell you about a new underground tactic that makes me personally $900 per day on 100% AUTOPILOT. I really could be here all day and going into detail but why dont you merely check their site out? There is really a great video that explains everything. So if your seriously interested in producing effortless cash this is the site for you. Auto Traffic Avalanche