SYNOPSIS

jodreports <template-document> <data-file> <output-document>

DESCRIPTION

jodreports is a java program that merge OpenDocument text with data by using libjodreports-java. The command line tool is especially useful to test templates while you are adding instructions to them. You use a .properties or .xml file to contain the <data-file> to be merged into the template. The <template-document> needs to be an existing OpenDocument text with simple fields. A field that will be replaced with the value of a variable passed can be specified using the standard FreeMarker expression notation by typing the variable name into the document as follows

Hi ${name}!

here name will be replaced with the value passed in at runtime.

However, mixing processing instructions and normal text into the document may become confusing and clutter the layout. So JOOReports provides an alternative way of inserting fields. You can insert a visual field in OpenOffice.org Writer from the menu Insert / Fields / Other... (or just press Ctrl+F2), then click on the Functions tab and select Input field. Change the field Reference to JOOScript and in the following field Content enter the variable name (e.g. "$name"). This field will typically be displayed by Writer as a grayed rectangle with the variable name, while moving the mouse over it will reveal the field reference.

This is a nice way of keeping processing instructions separate from the document layout and is thus the recommended approach. Whatever you specify as the field Reference will be treated as a FreeMarker ${...} expression, so it could also be something more complex than a simple variable name.

To insert more advanced instructions, e.g. for conditionally displaying a portion of text, or repeating a table row for each item in a collection, you can use FreeMarker directives.

A simple directive is assign. You can use it to define a new variable, for example

[#assign totalPrice = unitPrice * quantity]

Note that we always use the alternative (square bracket) syntax for FreeMarker directives.

While it may be possible to insert this directive directly as text into the template, this does not always work (for reasons we'll see below) and as mentioned mixing instructions into the document is a practice we want to avoid anyway. For this reason, JOOReports lets you insert FreeMarker directives as scripts. You can insert a script in Writer from the menu Insert / Script..., then change the Script type to JOOScript and insert any FreeMarker directives in the script Text box. A script will be displayed by Writer as a small green rectangle, and you can double click on it to open it and modify it.

So you directive will be executed at the point where the script has been inserted. This is ok for something like assign but as we'll see will not work for something like list.

Alternatively, you can insert a FreeMarker directive in OpenOffice.org Writer from the menu Insert / Fields / Other... (or just press Ctrl+F2), then click on the Functions tab and select Input field. Change the field Reference to JOOScript and in the following field Content enter the directive (e.g. "[#assign title='Mr.']"). Sample Open Document Template

Again this provides a nice way to insert processing instructions and keept them separate from the document layout.

The <output-document> is also an OpenDocument text and will be created as the result of the merge.

JOOReports uses FreeMarker as its template engine.

FILES

/usr/share/java/jodreports.jar

AUTHOR

jodreports was written by Mirko Nasato <[email protected]> and Terry Liang <[email protected]>.

jodreports was packaged for the Debian project by Sascha Girrulat <[email protected]>.

This manual page was written by Sascha Girrulat <[email protected]>, for the Debian project (and may be used by others). Most of the used information are reused from http://jodreports.sourceforge.net.