Course Jasper PPT
Course Jasper PPT
5.6.0
Agenda
INTRODUCTION
LIFE CYCLE
CREATING AND USING DATABASE JDBC CONNECTIONS
DESIGN
COMPILING REPORT DESIGN
EXPORTING REPORTS
REPORTS PARAMETERS
REPORT FIELDS
REPORT FONTS
REPORT VARIABLES
REPORT SECTIONS
REPORT GROUPS
REPORT STYLES
CREATE SUBREPORTS
INTRODUCTION
What is a Report?
Open source reporting software
Report Template
A4
LandScape
Letter
Letter LandScape
Report Sections
Features of JasperReports
A JDBC connection
To edit the connection dataBase, click File -> New ->
DataAdapter
Step 1
Step 2
Step 3
Step 4 “JDBC Drivers List”
Step 5
add the ojdbc6.jar file
The Dataset
To create a dataset, right-click on the report root node
in the outline view and choose Create Dataset
Step 1
Step 2
Add Query
Choice column
DESIGN
Parameter Declaration
<parameter name="exampleParameter" class="java.lang.String" />
The Name Attribute : <parameter>
The Class Attribute : $P{} java.lang.String.
Built-in Parameters
REPORT_PARAMETERS_MAP
REPORT_CONNECTION
REPORT_DATA_SOURCE
REPORT_MAX_COUNT
REPORT_SCRIPTLET
REPORT_LOCALE
REPORT_RESOURCE_BUNDLE
REPORT_TIME_ZONE
REPORT_VIRTUALIZER
REPORT_CLASS_LOADER
IS_IGNORE_PAGINATION
REPORT FIELDS
Field Declaration
<field name="FieldName" class="java.lang.String"/>
The Name Attribute : <field>
The Class Attribute : $F{}
Field Description : <fieldDesciption>
<fieldDescription><![CDATA[FieldName]]></fieldDescription>
Elements
Properties field
Sort Fields <sortField>
At the times when data sorting is required and the data
source implementation doesn't support it
Example
<sortField name="country" order="Descending"/>
REPORT FONTS
<style>
This element is a collection of style settings declared
at the report level.
Styles can extend other styles, and add to, or override
properties of the parent style as well.
Style Properties
Conditional Styles
A style should be applied only when certain condition is
met (for example, to alternate adjacent row colors in a
report detail section).
The style is used only if the condition evaluates to
true.
A conditional style has two elements:
a Boolean condition expression
a style
Example
<style name="style" mode="Opaque" forecolor="#000000"
backcolor="#EDF0EF" fontName="Arial">
<conditionalStyle>
<conditionExpression>
<![CDATA[new Boolean($V{REPORT_COUNT}.intValue() % 2 == 0)]]>
</conditionExpression>
<style mode="Transparent" forecolor="#000000"/>
</conditionalStyle>
</style>
CREATE SUBREPORTS