public abstract class JasperReportsUtils extends Object
Constructor and Description |
---|
JasperReportsUtils() |
Modifier and Type | Method and Description |
---|---|
static net.sf.jasperreports.engine.JRDataSource |
convertReportData(Object value)
Convert the given report data value to a
JRDataSource . |
static void |
render(net.sf.jasperreports.engine.JRExporter exporter,
net.sf.jasperreports.engine.JasperPrint print,
OutputStream outputStream)
Render the supplied
JasperPrint instance using the
supplied JRAbstractExporter instance and write the results
to the supplied OutputStream . |
static void |
render(net.sf.jasperreports.engine.JRExporter exporter,
net.sf.jasperreports.engine.JasperPrint print,
Writer writer)
Render the supplied
JasperPrint instance using the
supplied JRAbstractExporter instance and write the results
to the supplied Writer . |
static void |
renderAsCsv(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
Writer writer)
Render a report in CSV format using the supplied report data.
|
static void |
renderAsCsv(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
Writer writer,
Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters)
Render a report in CSV format using the supplied report data.
|
static void |
renderAsHtml(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
Writer writer)
Render a report in HTML format using the supplied report data.
|
static void |
renderAsHtml(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
Writer writer,
Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters)
Render a report in HTML format using the supplied report data.
|
static void |
renderAsPdf(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
OutputStream stream)
Render a report in PDF format using the supplied report data.
|
static void |
renderAsPdf(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
OutputStream stream,
Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters)
Render a report in PDF format using the supplied report data.
|
static void |
renderAsXls(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
OutputStream stream)
Render a report in XLS format using the supplied report data.
|
static void |
renderAsXls(net.sf.jasperreports.engine.JasperReport report,
Map<String,Object> parameters,
Object reportData,
OutputStream stream,
Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters)
Render a report in XLS format using the supplied report data.
|
public static net.sf.jasperreports.engine.JRDataSource convertReportData(Object value) throws IllegalArgumentException
JRDataSource
.
In the default implementation, a JRDataSource
,
java.util.Collection
or object array is detected.
The latter are converted to JRBeanCollectionDataSource
or JRBeanArrayDataSource
, respectively.
value
- the report data value to convertnull
)IllegalArgumentException
- if the value could not be convertedJRDataSource
,
JRBeanCollectionDataSource
,
JRBeanArrayDataSource
public static void render(net.sf.jasperreports.engine.JRExporter exporter, net.sf.jasperreports.engine.JasperPrint print, Writer writer) throws net.sf.jasperreports.engine.JRException
JasperPrint
instance using the
supplied JRAbstractExporter
instance and write the results
to the supplied Writer
.
Make sure that the JRAbstractExporter
implementation
you supply is capable of writing to a Writer
.
exporter
- the JRAbstractExporter
to use to render the reportprint
- the JasperPrint
instance to renderwriter
- the Writer
to write the result tonet.sf.jasperreports.engine.JRException
- if rendering failedpublic static void render(net.sf.jasperreports.engine.JRExporter exporter, net.sf.jasperreports.engine.JasperPrint print, OutputStream outputStream) throws net.sf.jasperreports.engine.JRException
JasperPrint
instance using the
supplied JRAbstractExporter
instance and write the results
to the supplied OutputStream
.
Make sure that the JRAbstractExporter
implementation you
supply is capable of writing to a OutputStream
.
exporter
- the JRAbstractExporter
to use to render the reportprint
- the JasperPrint
instance to renderoutputStream
- the OutputStream
to write the result tonet.sf.jasperreports.engine.JRException
- if rendering failedpublic static void renderAsCsv(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, Writer writer) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsCsv(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, Writer writer, Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsHtml(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, Writer writer) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsHtml(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, Writer writer, Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsPdf(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, OutputStream stream) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsPdf(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, OutputStream stream, Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsXls(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, OutputStream stream) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsXls(net.sf.jasperreports.engine.JasperReport report, Map<String,Object> parameters, Object reportData, OutputStream stream, Map<net.sf.jasperreports.engine.JRExporterParameter,Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)