| Basics in Jasper | IReport | Run Jasper |
Run Jasper
Once you have JRXML File created you are ready to run jasper report in your application.
check the below codes to execute the jasper report;
InputStream input=new FileInputStream(new File(jrXMLPath));
JasperDesign jasperDesign = JasperManager.loadXmlDesign(input);
jasperReport = JasperCompileManager.compileReport(jasperDesign);
jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JRResultSetDataSource(getResultSet(whereClause)));
// if you want to stream to the browser use this
byteArray = JasperExportManager.exportReportToPdf(jasperPrint );
//else
JasperExportManager.exportReportToPdfFile(jasperPrint ,"myReport.pdf");
similarly you can create reports in HTML, RTF (WORD), Excel or XML Format.
check the below codes to execute the jasper report;
InputStream input=new FileInputStream(new File(jrXMLPath));
JasperDesign jasperDesign = JasperManager.loadXmlDesign(input);
jasperReport = JasperCompileManager.compileReport(jasperDesign);
jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JRResultSetDataSource(getResultSet(whereClause)));
// if you want to stream to the browser use this
byteArray = JasperExportManager.exportReportToPdf(jasperPrint );
//else
JasperExportManager.exportReportToPdfFile(jasperPrint ,"myReport.pdf");
similarly you can create reports in HTML, RTF (WORD), Excel or XML Format.
bravenet.com