19
Albert Guo 1

A Short Intorduction to JasperReports

Embed Size (px)

Citation preview

Page 1: A Short Intorduction to JasperReports

Albert Guo

1

Agenda Introduction

Prerequisites

Typical Workflow

Document Sections (Bands) Overview

JasperReports Architecture

2

Introduction Open source Java reporting library

Under the Lesser GNU Public License (LGPL)

Since 2001

Backed by a company now JasperSoft

2007 Dukersquos Choice Award Winner

3

Introduction ndash cont Support multiple data sources

Database connection

Embedded SQL statement

Java Collections (Collection Array and Map)

JDBC result set

Support multiple report formats

PDF XLS CSV HTML XML RTF ODT TXT

4

Prerequisites Download Sun Java 2 SDK 15 or newer

iReport eats a lot of RAM and so it is necessary to have at

least 256MB of memory and about 20MB of free space on

disk

Download iReport from httpsourceforgenetprojectsireport

Download JasperReports from

httpsourceforgenetprojectsjasperreportsfilesjasperreport

s

5

Fail to open jrxml by iReport Problem

As I use iReport 402 to open jrxml file but it show this error message

javaxxmlparsersFactoryConfigurationError Provider orgapachexercesjaxpSAXParserFactoryImpl not found at javaxxmlparsersSAXParserFactorynewInstance(SAXParserFactoryjava134) at orgnetbeanslibuihandlerLogRecordsscan(LogRecordsjava127) at orgnetbeansmodulesuihandlerInstallergetLogs(Installerjava681) at orgnetbeansmodulesuihandlerInstaller$Submit(Installerjava1317)

Solution

Change your JAVA_HOME to standard JDK instead of IBM JDK

6

Typical Workflow

7

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 2: A Short Intorduction to JasperReports

Agenda Introduction

Prerequisites

Typical Workflow

Document Sections (Bands) Overview

JasperReports Architecture

2

Introduction Open source Java reporting library

Under the Lesser GNU Public License (LGPL)

Since 2001

Backed by a company now JasperSoft

2007 Dukersquos Choice Award Winner

3

Introduction ndash cont Support multiple data sources

Database connection

Embedded SQL statement

Java Collections (Collection Array and Map)

JDBC result set

Support multiple report formats

PDF XLS CSV HTML XML RTF ODT TXT

4

Prerequisites Download Sun Java 2 SDK 15 or newer

iReport eats a lot of RAM and so it is necessary to have at

least 256MB of memory and about 20MB of free space on

disk

Download iReport from httpsourceforgenetprojectsireport

Download JasperReports from

httpsourceforgenetprojectsjasperreportsfilesjasperreport

s

5

Fail to open jrxml by iReport Problem

As I use iReport 402 to open jrxml file but it show this error message

javaxxmlparsersFactoryConfigurationError Provider orgapachexercesjaxpSAXParserFactoryImpl not found at javaxxmlparsersSAXParserFactorynewInstance(SAXParserFactoryjava134) at orgnetbeanslibuihandlerLogRecordsscan(LogRecordsjava127) at orgnetbeansmodulesuihandlerInstallergetLogs(Installerjava681) at orgnetbeansmodulesuihandlerInstaller$Submit(Installerjava1317)

Solution

Change your JAVA_HOME to standard JDK instead of IBM JDK

6

Typical Workflow

7

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 3: A Short Intorduction to JasperReports

Introduction Open source Java reporting library

Under the Lesser GNU Public License (LGPL)

Since 2001

Backed by a company now JasperSoft

2007 Dukersquos Choice Award Winner

3

Introduction ndash cont Support multiple data sources

Database connection

Embedded SQL statement

Java Collections (Collection Array and Map)

JDBC result set

Support multiple report formats

PDF XLS CSV HTML XML RTF ODT TXT

4

Prerequisites Download Sun Java 2 SDK 15 or newer

iReport eats a lot of RAM and so it is necessary to have at

least 256MB of memory and about 20MB of free space on

disk

Download iReport from httpsourceforgenetprojectsireport

Download JasperReports from

httpsourceforgenetprojectsjasperreportsfilesjasperreport

s

5

Fail to open jrxml by iReport Problem

As I use iReport 402 to open jrxml file but it show this error message

javaxxmlparsersFactoryConfigurationError Provider orgapachexercesjaxpSAXParserFactoryImpl not found at javaxxmlparsersSAXParserFactorynewInstance(SAXParserFactoryjava134) at orgnetbeanslibuihandlerLogRecordsscan(LogRecordsjava127) at orgnetbeansmodulesuihandlerInstallergetLogs(Installerjava681) at orgnetbeansmodulesuihandlerInstaller$Submit(Installerjava1317)

Solution

Change your JAVA_HOME to standard JDK instead of IBM JDK

6

Typical Workflow

7

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 4: A Short Intorduction to JasperReports

Introduction ndash cont Support multiple data sources

Database connection

Embedded SQL statement

Java Collections (Collection Array and Map)

JDBC result set

Support multiple report formats

PDF XLS CSV HTML XML RTF ODT TXT

4

Prerequisites Download Sun Java 2 SDK 15 or newer

iReport eats a lot of RAM and so it is necessary to have at

least 256MB of memory and about 20MB of free space on

disk

Download iReport from httpsourceforgenetprojectsireport

Download JasperReports from

httpsourceforgenetprojectsjasperreportsfilesjasperreport

s

5

Fail to open jrxml by iReport Problem

As I use iReport 402 to open jrxml file but it show this error message

javaxxmlparsersFactoryConfigurationError Provider orgapachexercesjaxpSAXParserFactoryImpl not found at javaxxmlparsersSAXParserFactorynewInstance(SAXParserFactoryjava134) at orgnetbeanslibuihandlerLogRecordsscan(LogRecordsjava127) at orgnetbeansmodulesuihandlerInstallergetLogs(Installerjava681) at orgnetbeansmodulesuihandlerInstaller$Submit(Installerjava1317)

Solution

Change your JAVA_HOME to standard JDK instead of IBM JDK

6

Typical Workflow

7

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 5: A Short Intorduction to JasperReports

Prerequisites Download Sun Java 2 SDK 15 or newer

iReport eats a lot of RAM and so it is necessary to have at

least 256MB of memory and about 20MB of free space on

disk

Download iReport from httpsourceforgenetprojectsireport

Download JasperReports from

httpsourceforgenetprojectsjasperreportsfilesjasperreport

s

5

Fail to open jrxml by iReport Problem

As I use iReport 402 to open jrxml file but it show this error message

javaxxmlparsersFactoryConfigurationError Provider orgapachexercesjaxpSAXParserFactoryImpl not found at javaxxmlparsersSAXParserFactorynewInstance(SAXParserFactoryjava134) at orgnetbeanslibuihandlerLogRecordsscan(LogRecordsjava127) at orgnetbeansmodulesuihandlerInstallergetLogs(Installerjava681) at orgnetbeansmodulesuihandlerInstaller$Submit(Installerjava1317)

Solution

Change your JAVA_HOME to standard JDK instead of IBM JDK

6

Typical Workflow

7

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 6: A Short Intorduction to JasperReports

Fail to open jrxml by iReport Problem

As I use iReport 402 to open jrxml file but it show this error message

javaxxmlparsersFactoryConfigurationError Provider orgapachexercesjaxpSAXParserFactoryImpl not found at javaxxmlparsersSAXParserFactorynewInstance(SAXParserFactoryjava134) at orgnetbeanslibuihandlerLogRecordsscan(LogRecordsjava127) at orgnetbeansmodulesuihandlerInstallergetLogs(Installerjava681) at orgnetbeansmodulesuihandlerInstaller$Submit(Installerjava1317)

Solution

Change your JAVA_HOME to standard JDK instead of IBM JDK

6

Typical Workflow

7

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 7: A Short Intorduction to JasperReports

Typical Workflow

7

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 8: A Short Intorduction to JasperReports

Document Sections (Bands)

Overview

8

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 9: A Short Intorduction to JasperReports

Document Sections (Bands)

Overview Document

Sections

Description

title printed only once at the beginning of the report

pageHeader printed at the beginning of every page in the report

Column Header printed at the beginning of each detail column

Detail corresponds to every record that is read by the datasource that feeds the

report

Column Footer The column footer band appears at the end of every column

Page Footer The page footer band appears on every page where there is a page

header

Summary The summary band allows you to insert fields concerning total calculations

means or whatever

you want to insert at the end of the report

9

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 10: A Short Intorduction to JasperReports

Check ldquoBlank When Nullrdquo

10

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 11: A Short Intorduction to JasperReports

Avoid broken character

11

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 12: A Short Intorduction to JasperReports

JasperReports Architecture

12

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 13: A Short Intorduction to JasperReports

JasperReports Architecture

13

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 14: A Short Intorduction to JasperReports

Maven 2 JasperReports Plugin This plugin provides the capability to compile Jasper Report

xml design files

14

http0rzcomRMSbdY

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 15: A Short Intorduction to JasperReports

JasperReports Architecture

15

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 16: A Short Intorduction to JasperReports

5 Steps to export report Step Description

Get data source Input List of value object and create

JRBeanCollectionDataSource

Read Jasper

File

Read jasper file

Generate

JasperPrint

Read report input stream and create JasperPrint

object

Set response

content type and

header

Assign content type and header based on the

export type

Export Report Assign export API to do export based on the export

type

16

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 17: A Short Intorduction to JasperReports

5 Steps to export report ndash cont

17

http0rzcom3MrvkI

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 18: A Short Intorduction to JasperReports

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly

18

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW

Page 19: A Short Intorduction to JasperReports

MS Excel wasnt displaying a CSV

file with UTF-8 encoding correctly In the absence of any charset identification Excel must

guess about a files content encoding Therefore Excel uses

that default to read and display CSV files

19

byte-order marker (BOM)

byte b[] = (byte)0xEF (byte)0xBB (byte)0xBF

insert BOM byte array into outputStream

outputStreamwrite(b)

httphttp0rzcomQFcaEW