Skip navigation.
Home
Java OpenDocument Reports

Quick Start

Use as a Command Line Tool

If you want to use JODReports as a command line tool, you can download the jodreports-cli-2.x.zip distribution.
Once you have unpacked it, you can execute the jar file directly to use it from the command line, e.g.

$ java -jar jodreports-cli-2.x-jar-with-dependencies.jar
USAGE: net.sf.jooreports.tools.CreateAndConvertDocument <template-document> <data-file> <output-document>
$ java -jar jodreports-cli-2.x-jar-with-dependencies.jar order-template.odt order-data.xml order.odt

will create and order document in ODT format.

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 to be merged into the template.

Use as a Library

If you want to include JODReports as a library in your application, you can download the jodreports-2.x.jar file directly.
And the library is available as an artifact from the central Maven repository so it can be included as a dependency in your own Maven-managed projects simply by adding the following lines to your project's pom.xml:

<dependency>
   <groupId>net.sf.jodreports</groupId>
   <artifactId>jodreports</artifactId>
   <version>2.x</version>
</dependency>

A basic example of using JODReports as a library in your Java code would be

DocumentTemplateFactory documentTemplateFactory = new DocumentTemplateFactory();
DocumentTemplate template = documentTemplateFactory.getTemplate(new File("my-template.odt"));
Map data = new HashMap();
data.put("var", "value");
//...
template.createDocument(data, new FileOutputStream("my-output.odt"));

this uses a simple Map to hold variables. Alternatively you can pass a more complex Java object model, or use XML.

Use as a Web Application

For use as a web application it is easier to download the jodreports-webapp-2.x.zip distribution, which includes a standard web application archive, and deploy it into your favourite servlet container or application server.

For Apache Tomcat for example just copy the war file into the webapps directory in your Tomcat installation and it will be visible at (typically) http://localhost:8080/jodreports-webapp-2.x/.

The web application includes the demos you can see online and can be used as it is or a starting point for integrating JODReports into your own web applications.