OpenOffice.org file (*.ods, *.odt etc) is actually a collection of xml files
packed together with zip. If you unzip a file, you'll find a content.xml file -
that's the most interesting one for us.
ERP5 needs two files to create an OOo report: a template, which is the whole OOo
file, and the ERP5 OOo template, which will contain dynamically generated content.
Table of Contents
Create OOO Report¶
-
Create a template object
Create an OOo file (a text doc or spreadsheet, whichever you want); upload
it to your skin folder in portal_skins as an ordinary file. Note that you
can use the same template File for multiple ERP5 OOo Template.
-
Create a content object
Create another OOo file of the same type, put some dummy content into it.
In portal_skins, create an ERP5 OOo Template; open the "edit" tab and upload
your file - ERP5 will automatically extract content.xml from it and make
appropriate changes. Go to the Stylesheet settings tab, enter the id of
the template object you created before.
-
Create dynamic content
Your ERP5 OOo Template object contents is an xml file - you can put TAL
expressions into it, just as you do in ZPTs. Just be careful and stick
closely to the original syntax. If you need advise how to achieve a particular
layout or formatting, just do it in OpenOffice.org, save the file, unzip,
take a look at content.xml and you'll know. OpenOffice.org doesn't interpret
spanning tags (
or ), so you can use them but only with tal:omit_tag
or tal:block expressions, so they are removed after TALES evaluation.
-
Use it
If you click Test tab, or call the template from a request, it will generate
an OOo file and ship it directly to your browser with appropriate header
information.
-
oood integration
If you have setup an OpenOffice.org conversion daemon, you can pass format
as REQUEST parameters to do automatic conversion to a given format, by giving
its short name (for example, ?format=pdf or ?format=doc ). Just make sure
you set the two Preference attributes: [StringField] preferred_ooodoc_server_address
(Conversion server address) and [IntegerField] preferred_ooodoc_server_port_number
(Conversion server port). Fill them in with actual data regarding installed
and running oood.
${related_subject}