Sample Reference - Schema Reference - Configuration Reference - API (Javadoc)

JasperReports - Landscape Sample (version 3.7.6)


Shows how reports can be generated and printed in "Landscape" page format.

Download All Sample Source Files
Browse Sample Source Files on SVN


Main Features in This Sample

Creating Landscape Orientation Report Templates


top

Creating Landscape Orientation Report TemplatesDocumented by Sanda Zaharia


Description / Goal
How to create landscape orientation reports.

Since
0.1.0


This feature is used when a report should be visualized or printed in the Landscape page layout. A page is considered to be in a Landscape orientation when its width and height appear as interchanged.
In order to manage its pages layout, the <jasperReport /> element contains the orientation attribute.
Values allowed for this attribute are:
  • Portrait
  • Landscape
By default, in JasperReports pages are visualized as Portrait. The orientation being an attribute at report level, its value applies to all pages in the generated document.
Below is a code snippet showing how to set in a report the Landscape orientation:
<jasperReport
		xmlns="http://jasperreports.sourceforge.net/jasperreports"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
		name="LandscapeReport" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="842" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
Here one can observe that pageWidth and pageHeight values were interchanged and the orientation attribute takes the Landscape value.

In order to figure out more on page orientation behavior, just test this sample by running from the command line the ant test view command. It will generate all supported document types containing the sample report in the /build/reports directory, and then the generated report will be open with JasperReports internal viewer.



© 2001-2010 Jaspersoft Corporation www.jaspersoft.com