You are on page 1of 364

TABLE OF CONTENTS

CHAPTER 1 INTRODUCTION

1.1 Features of iReport


1.2 The iReport Community

1.3 JasperReports Commercial License


1.4 Code Used in This Book
CHAPTER 2 GETTING STARTED

2.1 Platform Requirements

2.2 Downloads
2.3 Development Versions

2.4 Compiling iReport


2.5 Installing iReport
2.6 The Windows Installer
2.7 Installing iReport on Mac OSX

2.8 First iReport Execution


2.9 Creating a JDBC Connection
2.10 Creating Your First Report

2.10.1 Using the Sample Database

2.10.2 Using the Report Wizard


CHAPTER 3 BASIC NOTIONS OF JASPERREPORTS

3.1 The Report Life Cycle


3.2 JRXML Sources and Jasper Files
3.3 Data Sources and Print Formats

3.4 Compatibility Between Versions


3.5 Expressions

3.5.1 The Type of an Expression


3.5.2 Expression Operators and Object Methods
3.5.3 Using an If-Else Construct in an Expression
3.6 Using Java as a Language for Expressions

3.7 Using Groovy as a Language for Expressions


3.8 Using JavaScript as a Language for Expressions
3.9 Using JasperReports Extensions in iReport

3.10 A Simple Program


CHAPTER 4 REPORT STRUCTURE

4.1 Bands
4.1.1 Report Properties
4.1.2 Columns
4.1.3 Advanced Report Options

4.1.3.1 Scriptlet

4.1.3.2 Resource Bundle


4.1.3.3 Query

4.1.3.4 Filter Expression

4.1.3.5 Properties
4.1.3.6 Title and Summary on a New Page
4.1.3.7 Summary with Page Header and Footer

4.1.3.8 Floating Column Footer Option

4.1.3.9 Print Order


4.1.3.10 Print without data

4.1.3.11 Format Factory Class


4.1.3.12 Imports

4.2 Working with Bands


4.2.1 Band Height

4.2.2 Print When Expression


4.2.3 Split Allowed and Split Type

4.3 Summary
CHAPTER 5 REPORT ELEMENTS
5.1 Working with Elements
5.1.1 Formatting Tools
5.1.2 Managing Elements with the Report Inspector

5.1.3 Basic Element Attributes


5.1.4 Element Custom Properties
5.1.5 Graphic Elements
5.1.5.1 Line
5.1.5.2 Rectangle

5.1.5.3 Ellipse
5.2 Working with Images
5.2.1 Padding and Borders
5.2.2 Loading an Image from the Database (BLOB Field)

5.2.3 Creating an Image Dynamically


5.3 Working with Text
5.3.1 Static Text

5.3.2 Textfields
Need not be quoted in prefix or suffix.
5.4 Other Elements

5.4.1 Subreports
5.4.2 Frame
5.4.3 Chart

5.4.4 Crosstab

5.4.5 Page/Column Break


5.5 Adding Custom Components and Generic Elements

5.6 Anchors
5.6.1 Hyperlink Type

5.6.2 Hyperlink Parameters

5.6.3 Hyperlink Tooltip


CHAPTER 6 FIELDS , PARAMETERS , AND VARIABLES
6.1 Working with Fields
6.1.1 Registration of the Fields from a SQL Query
6.1.2 Accessing the SQL Query Designer

6.1.3 Registration of the Fields of a JavaBean


6.1.4 Fields and Textfields
6.2 Working with Parameters

6.2.1 Using Parameters in a Query


6.2.2 IN and NOTIN clause
6.2.3 Built-in Parameters
6.2.4 Relative Dates
6.2.5 Passing Parameters from a Program
6.3 Working with Variables
6.4 Evaluating Elements During Report Generation

Page X of Y
CHAPTER 7 BANDS AND GROUPS

7.1 Modifying Bands


7.2 Working with Groups
7.3 Other Group Options
CHAPTER 8 FONTS AND STYLES

8.1 Working with Fonts


8.2 Using TrueType Fonts
8.3 Using the Font Extensions
8.4 Character Encoding

8.5 Use of Unicode Characters

8.6 Working with Styles


8.7 Creating Style Conditions
8.8 Referencing Styles in External Property Sheets

CHAPTER 9 TEMPLATES
9.1 Template Structure Overview
9.2 Groups
9.3 Column Header

9.4 Detail Band

9.5 Template Type and Other Options


9.6 Creating a New Template
9.7 Installing and Using the Template
CHAPTER 10 DATA SOURCES AND QUERY EXECUTERS

10.1 How a JasperReports Data Source Works


10.2 Understanding Data Sources and Connections in iReport
10.3 Creating and Using JDBC Connections
10.3.1 ClassNotFoundError
10.3.2 URL Not Correct

10.3.3 Parameters Not Correct for the Connection

10.3.4 Creating a JDBC Connection via the Services View


10.4 Working with Your JDBC Connection
10.4.1 Fields Registration

10.4.2 Sorting and Filtering Records


10.5 Understanding the JRDataSource Interface
10.6 Data Source Types

10.6.1 Using JavaBeans Set Data Sources


10.6.2 Fields of a JavaBean Set Data Source
10.6.3 Using XML Data Sources
10.6.4 Registration of the Fields for an XML Data Source
10.6.5 XML Data Source and Subreports
10.6.6 Using CSV Data Sources
10.6.7 Registration of the Fields for a CSV Data Source
10.6.8 Using JREmptyDataSource

10.6.9 Using HQL and Hibernate Connections


10.6.10 Using a Hadoop Hive Connection
10.6.11 How to Implement a New JRDataSource
10.6.12 Using a Personalized JRDataSource with iReport
10.7 Importing and Exporting Data Sources
10.8 Creating Custom Languages and Query Executers
10.8.1 Creating a Query Executer for a Custom Language
10.8.2 Creating a FieldsProvider
CHAPTER 11 CHARTS

11.1 Creating a Simple Chart


11.2 Using Datasets

11.3 Value Hyperlinks


11.4 Properties of Charts
11.5 Using Chart Themes

11.5.1 Using the Chart Theme Designer


11.5.1.1 Editing Chart Theme XML

11.5.2 Creating a JasperReports Extension for a Chart Theme


11.5.3 Using a Chart Theme in the Report Designer
11.6 HTML5 Charts
CHAPTER 12 FLASH CHARTS
12.1 Viewing Flash Objects

12.2 Using Maps Pro

12.2.1 Creating Maps


12.2.2 Determining Map Entity IDs
12.2.3 Specifying Map Data
12.2.4 Specifying Map Colors
12.2.5 Localizing Maps
12.3 Using Charts Pro
12.3.1 Creating Charts
12.3.2 Specifying Chart Data
12.3.3 Defining Trend Lines
12.4 Using Widgets Pro

12.4.1 Widget Types


12.4.2 Creating Widgets
12.4.3 Specifying Widget Data

12.4.3.1 Cylinder
12.4.3.2 Angular and Linear Gauges
12.4.3.3 Funnel Chart
12.4.3.4 Gantt Chart
12.4.3.5 Category Sets
12.4.3.6 Processes and Tasks
12.4.3.7 Milestones
12.4.3.8 Connectors

12.4.3.9 Trend Lines

12.4.3.10 Data Table


12.4.3.11 Legend Items

12.5 Embedding Components in a Java Application


12.6 Localizing a Component

12.7 Component Limitations


CHAPTER 13 LISTS , TABLES , AND BARCODES

13.1 Lists

13.1.1 Working with the List Component


13.1.2 Parameters and Variables in a List Element
13.1.3 List Component Issues
13.1.4 Print Order: Vertical and Horizontal Lists

13.1.5 Other Uses of the List

13.1.6 Compatibility
13.2 Tables

13.2.1 Creating a Table


13.2.2 Table Structure

13.2.2.1 The Table Element


13.2.2.2 Column Groups
13.2.2.3 Table Cells
13.2.3 Editing the Table Layout

13.2.4 Editing the Dataset Run


13.2.5 Working with Columns
13.2.6 Compatibility

13.3 Barcodes
13.3.1 Working with Barcodes
13.3.2 Barbecue Component

13.3.3 Barcode4J Component


13.3.4 Compatibility
CHAPTER 14 SUBDATASETS

14.1 Creating a Subdataset


14.2 Creating Dataset Runs
14.3 Working Through an Example Subdataset
CHAPTER 15 CROSSTABS

15.1 Using the Crosstab Wizard


15.2 Working with Columns, Rows, and Measures
15.2.1 Modifying Cells
15.2.2 Understanding Measures

15.3 Modifying Crosstab Element Properties


15.4 Crosstab Parameters
15.5 Working with Crosstab Data
15.6 Using Crosstab Total Variables
CHAPTER 16 INTERNATIONALIZATION

16.1 Using a Resource Bundle Base Name


16.2 Retrieving Localized Strings

16.3 Formatting Messages


16.4 Deploying Localized Reports

16.5 Generating a Report Using a Specific Locale and Time Zone


CHAPTER 17 SUBREPORTS

17.1 Creating a Subreport


17.1.1 Linking a Subreport to the Parent Report
17.1.2 Specifying the Subreport
17.1.3 Specifying the Data Source

17.1.4 Passing Parameters


17.2 A Step-by-Step Example
17.3 Returning Values from a Subreport
17.4 Using the Subreport Wizard

17.4.1 Create a New Report via the Subreport Wizard


17.4.2 Specifying an Existing Report in the Subreport Wizard
CHAPTER 18 SCRIPTLETS

18.1 Understanding the Class


18.2 Creating a Simple Scriptlet
18.3 Testing a Scriptlet in iReport
18.4 Accessing iReport Objects
18.5 Debugging a Scriptlet
18.6 Deploying Reports That Use Scriptlets
CHAPTER 19 ADDITIONAL TOOLS

19.1 Callout Tool


19.1.1 Current Date Tool
19.2 Page Number, Total Pages and Page X of Y Tools

19.2.1 Page Number Tools

19.2.2 Printing Page X of Y in a Single Textfield


19.3 Percentage Tool
19.4 Using a Background Image as Reference
19.5 How to Run the Samples
APPENDIX A CHART THEME EXAMPLE
INDEX

You might also like