01. Report Layout
The report xml definition for Pentaho Reports contains the following major sections; Report Header, Report Footer, Page Header, Page Footer, Groups including each group along with their corresponding header and footer, and Details/Items.
Report Sections
Elements |
Purpose |
---|---|
include |
Allows a report to reference another xml document for other report sections. For instance, multiple reports can reference a single report with only a page header defined for easier report maintenance. |
parser-config |
Sets variables with corresponding values for a report to use at runtime. Thus, common values can be set throughout a report like common text, background color or fonts. |
configuration |
Allows parameters to be set for special output handling or debugging purposes. |
watermark |
Printed before any other object is printed on a new page. This band can consume the complete space of the page and will never trigger a pagebreak. The watermark-band is intended to fill the page background. |
reportheader |
Determines content that prints on the first page of a report. |
reportfooter |
Determines content that prints on the last page of a report. |
pageheader |
Determines content that prints at the top of each page of a report. |
pagefooter |
Determines content that prints at the bottom of each page of a report. |
groups |
Determines how the report is grouped and the content of each group's header and footer. |
items |
Determines the fields and content will be the line items or details. |
functions |
Computes results based on predefined or customized mathematical expressions or complex scripts. |
Base XML
Below is the base definition for a report.
<?xml version="1.0" encoding="ISO-8859-1"?> <\!DOCTYPE report PUBLIC "-//JFreeReport//DTD report definition//EN//simple/version 0.8.5" "http://jfreereport.sourceforge.net/report-085.dtd"> <report> <include> </include> <parser-config> </parser-config> <configuration> </configuration> <watermark> </watermark> <reportheader> </reportheader> <pageheader> </pageheader> <groups> </groups> <items> </items> <pagefooter> </pagefooter> <reportfooter> </reportfooter> <functions> </functions> <watermark> </watermark> </report>
Example of Report Output
Position Objects
The position of an object in a section is declared by defining the x and y coordinates within a particular section. The top left starting point is x=0 and y=0 and is also the default position. When using an object, the mandatory attributes that need to be specified are the x (horizontal position), y (vertical position), height and width. These attributes are defined in 1/72 inch unit increments. These can be defined in units or percent. When using percent to define y and height, the container's height must be specified. The container's height is computed automatically. If a height is defined, it serves as a minimum-height. Therefore a band can increase its height beyond that size. Relative x and width values are resolved against the width of the parent (which corresponds to 100%). Relative y and height values are resolved against the used height of an container. For that computation, the reporting engine first computes the effective height of all absolutely positioned elements and uses that height as 100%. Then it computes the complete layout for all elements, with all relative sizes resolved against that height.
X & Y Coordinate Example
As with every element container, you may define default font settings for sub elements without their own font definition.