| java.lang.Object org.springframework.ui.jasperreports.JasperReportsUtils
JasperReportsUtils | abstract public class JasperReportsUtils (Code) | | Utility methods for working with JasperReports. Provides a set of convenience
methods for generating reports in a CSV, HTML, PDF and XLS formats.
author: Rob Harrop author: Juergen Hoeller since: 1.1.3 |
Method Summary | |
public static JRDataSource | convertReportData(Object value) Convert the given report data value to a JRDataSource . | public static void | render(JRExporter exporter, JasperPrint print, Writer writer) Render the supplied JasperPrint instance using the
supplied JRAbstractExporter instance and write the results
to the supplied Writer . | public static void | render(JRExporter exporter, JasperPrint print, OutputStream outputStream) Render the supplied JasperPrint instance using the
supplied JRAbstractExporter instance and write the results
to the supplied OutputStream . | public static void | renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer) Render a report in CSV format using the supplied report data. | public static void | renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer, Map exporterParameters) Render a report in CSV format using the supplied report data. | public static void | renderAsHtml(JasperReport report, Map parameters, Object reportData, Writer writer) Render a report in HTML format using the supplied report data. | public static void | renderAsHtml(JasperReport report, Map parameters, Object reportData, Writer writer, Map exporterParameters) Render a report in HTML format using the supplied report data. | public static void | renderAsPdf(JasperReport report, Map parameters, Object reportData, OutputStream stream) Render a report in PDF format using the supplied report data. | public static void | renderAsPdf(JasperReport report, Map parameters, Object reportData, OutputStream stream, Map exporterParameters) Render a report in PDF format using the supplied report data. | public static void | renderAsXls(JasperReport report, Map parameters, Object reportData, OutputStream stream) Render a report in XLS format using the supplied report data. | public static void | renderAsXls(JasperReport report, Map parameters, Object reportData, OutputStream stream, Map exporterParameters) Render a report in XLS format using the supplied report data. |
convertReportData | public static JRDataSource convertReportData(Object value) throws IllegalArgumentException(Code) | | Convert the given report data value to a JRDataSource .
In the default implementation, a JRDataSource ,
java.util.Collection or object array is detected.
The latter are converted to JRBeanCollectionDataSource
or JRBeanArrayDataSource , respectively.
Parameters: value - the report data value to convert the JRDataSource throws: IllegalArgumentException - if the value could not be converted See Also: net.sf.jasperreports.engine.JRDataSource See Also: net.sf.jasperreports.engine.data.JRBeanCollectionDataSource See Also: net.sf.jasperreports.engine.data.JRBeanArrayDataSource |
render | public static void render(JRExporter exporter, JasperPrint print, Writer writer) throws JRException(Code) | | Render the supplied 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 .
Parameters: exporter - the JRAbstractExporter to use to render the report Parameters: print - the JasperPrint instance to render Parameters: writer - the Writer to write the result to throws: JRException - if rendering failed |
render | public static void render(JRExporter exporter, JasperPrint print, OutputStream outputStream) throws JRException(Code) | | Render the supplied 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 .
Parameters: exporter - the JRAbstractExporter to use to render the report Parameters: print - the JasperPrint instance to render Parameters: outputStream - the OutputStream to write the result to throws: JRException - if rendering failed |
renderAsCsv | public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer) throws JRException(Code) | | Render a report in CSV format using the supplied report data.
Writes the results to the supplied Writer .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: writer - the Writer to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
renderAsCsv | public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer, Map exporterParameters) throws JRException(Code) | | Render a report in CSV format using the supplied report data.
Writes the results to the supplied Writer .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: writer - the Writer to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from Parameters: exporterParameters - a Map of JRExporterParameter exporter parameters throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
renderAsHtml | public static void renderAsHtml(JasperReport report, Map parameters, Object reportData, Writer writer) throws JRException(Code) | | Render a report in HTML format using the supplied report data.
Writes the results to the supplied Writer .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: writer - the Writer to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
renderAsHtml | public static void renderAsHtml(JasperReport report, Map parameters, Object reportData, Writer writer, Map exporterParameters) throws JRException(Code) | | Render a report in HTML format using the supplied report data.
Writes the results to the supplied Writer .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: writer - the Writer to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from Parameters: exporterParameters - a Map of JRExporterParameter exporter parameters throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
renderAsPdf | public static void renderAsPdf(JasperReport report, Map parameters, Object reportData, OutputStream stream) throws JRException(Code) | | Render a report in PDF format using the supplied report data.
Writes the results to the supplied OutputStream .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: stream - the OutputStream to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
renderAsPdf | public static void renderAsPdf(JasperReport report, Map parameters, Object reportData, OutputStream stream, Map exporterParameters) throws JRException(Code) | | Render a report in PDF format using the supplied report data.
Writes the results to the supplied OutputStream .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: stream - the OutputStream to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from Parameters: exporterParameters - a Map of JRExporterParameter exporter parameters throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
renderAsXls | public static void renderAsXls(JasperReport report, Map parameters, Object reportData, OutputStream stream) throws JRException(Code) | | Render a report in XLS format using the supplied report data.
Writes the results to the supplied OutputStream .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: stream - the OutputStream to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
renderAsXls | public static void renderAsXls(JasperReport report, Map parameters, Object reportData, OutputStream stream, Map exporterParameters) throws JRException(Code) | | Render a report in XLS format using the supplied report data.
Writes the results to the supplied OutputStream .
Parameters: report - the JasperReport instance to render Parameters: parameters - the parameters to use for rendering Parameters: stream - the OutputStream to write the rendered report to Parameters: reportData - a JRDataSource , java.util.Collection or object array (converted accordingly), representing the report data to readfields from Parameters: exporterParameters - a Map of JRExporterParameter exporter parameters throws: JRException - if rendering failed See Also: JasperReportsUtils.convertReportData |
|
|