A Short Intorduction to JasperReports

Preview:

Citation preview

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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