/** * Export to HTML * * @return SpecificTemplateExporterBuilderService * @throws JRException JRException exception */ public SpecificTemplateExporterBuilderService toHTML() throws JRException { JasperExportManager.exportReportToHtmlFile(this.report, getTemplatePath().replace(extensionPattern, "html")); return this; }
/** * Fills a report and saves it directly into a HTML file. * The intermediate JasperPrint object is not saved on disk. */ public static void runReportToHtmlFile( String sourceFileName, String destFileName, Map parameters, JRDataSource jrDataSource ) throws JRException { /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(sourceFileName, parameters, jrDataSource); /* */ JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName); }
/** * Fills a report and saves it directly into a HTML file. * The intermediate JasperPrint object is not saved on disk. */ public static void runReportToHtmlFile( String sourceFileName, String destFileName, Map parameters, Connection conn ) throws JRException { /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(sourceFileName, parameters, conn); JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName); }
/** * Fills a report and saves it directly into a HTML file. * The intermediate JasperPrint object is not saved on disk. * * @param sourceFileName source file containing the compile report design * @param destFileName name of the destination HTML file * @param parameters report parameters map * @throws JRException * @see net.sf.jasperreports.engine.fill.JRFiller#fillReport(JasperReport, Map) */ public static void runReportToHtmlFile( String sourceFileName, String destFileName, Map parameters ) throws JRException { /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(sourceFileName, parameters); JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName); }
/** * Exports the generated report file specified by the first parameter into HTML format, * placing the result into the second file parameter. * <p> * The images are placed as distinct files inside a directory having the same name * as the HTML destination file, plus the "_files" suffix. * * @param sourceFileName source file containing the generated report * @param destFileName file name to place the HTML content into * @see net.sf.jasperreports.engine.export.JRPdfExporter */ public static void exportReportToHtmlFile( String sourceFileName, String destFileName ) throws JRException { JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFileName); exportReportToHtmlFile( jasperPrint, destFileName ); }
/** * 根据指定的参数和Bean Collection数据源导出HTML文件 * @param jasperFile jasper文件路径 * @param toFile 目标HTML文件的路径,可以指定或者为null * @param params 模板所需的参数 * @param dataSource 模板所需的数据源 * @param <T> 数据源泛型 * @return 返回导出的HTML文件的路径,需要注意绝对路径和相对路径 */ public static <T> String exportHtml(String jasperFile, String toFile, Map<String, Object> params, List<T> dataSource) { String htmlFile = null; try { String jasperPrintFile = getJasperPrintFile(jasperFile, params, dataSource); if (toFile != null) { htmlFile = toFile; JasperExportManager.exportReportToHtmlFile(jasperPrintFile, htmlFile); } else { htmlFile = JasperExportManager.exportReportToHtmlFile(jasperPrintFile); } } catch (JRException e) { logger.error(e.getMessage()); } return htmlFile; }
/** * Gera um boleto em HTML, e grava no caminho informado. * * @param arquivo caminho do arquivo. */ public void geraHTML(String arquivo) { try { JasperExportManager.exportReportToHtmlFile(geraRelatorio(), arquivo); } catch (JRException e) { throw new GeracaoBoletoException(e); } }
/** * Gera um boleto em HTML, e grava no caminho informado. * * @param arquivo caminho do arquivo. */ public void geraHTML(String arquivo) { try { JasperExportManager.exportReportToHtmlFile(geraRelatorio(), arquivo); } catch (JRException e) { throw new GeracaoBoletoException(e); } }
/** * Exports the generated report file specified by the parameter into HTML format. * The resulting HTML file has the same name as the report object inside the source file, * plus the <code>*.html</code> extension and it is located in the same directory as the source file. * The images are placed as distinct files inside a directory having the same name * as the HTML destination file, plus the "_files" suffix. * * @param sourceFileName source file containing the generated report * @return resulting HTML file name * @see net.sf.jasperreports.engine.export.JRHtmlExporter */ public static String exportReportToHtmlFile( String sourceFileName ) throws JRException { File sourceFile = new File(sourceFileName); /* We need the report name. */ JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".html"); String destFileName = destFile.toString(); exportReportToHtmlFile( jasperPrint, destFileName ); return destFileName; }
/** * Fills a report and saves it directly into a HTML file. * The intermediate JasperPrint object is not saved on disk. */ public static String runReportToHtmlFile( String sourceFileName, Map parameters, Connection conn ) throws JRException { File sourceFile = new File(sourceFileName); /* */ JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); parameters = JasperFillManager.setFileResolver(sourceFile, parameters); /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn); /* */ File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".html"); String destFileName = destFile.toString(); JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName); return destFileName; }
/** * Fills a report and saves it directly into a HTML file. * The intermediate JasperPrint object is not saved on disk. */ public static String runReportToHtmlFile( String sourceFileName, Map parameters, JRDataSource jrDataSource ) throws JRException { File sourceFile = new File(sourceFileName); /* */ JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); parameters = JasperFillManager.setFileResolver(sourceFile, parameters); /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, jrDataSource); /* */ File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".html"); String destFileName = destFile.toString(); JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName); return destFileName; }
/** * Fills a report and saves it directly into a HTML file. * The intermediate JasperPrint object is not saved on disk. * * @param sourceFileName the name of the compiled report file * @param parameters the parameters map * @return the name of the generated HTML file * @throws JRException * @see net.sf.jasperreports.engine.fill.JRFiller#fillReport(JasperReport, Map) */ public static String runReportToHtmlFile( String sourceFileName, Map parameters ) throws JRException { File sourceFile = new File(sourceFileName); /* */ JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); parameters = JasperFillManager.setFileResolver(sourceFile, parameters); /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters); /* */ File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".html"); String destFileName = destFile.toString(); JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName); return destFileName; }
public void renderReport(boolean removeFrame) { try { JasperPrint jasperPrint = generateReport(removeFrame); log.info("BEGIN: Export report"); switch (reportType) { case HTML: JasperExportManager.exportReportToHtmlFile(jasperPrint, outputReportLocation); break; case PDF: JasperExportManager.exportReportToPdfStream(jasperPrint, Files.newOutputStream(Paths.get(outputReportLocation))); break; default: throw new ConfigurationException("ReportType is not specified"); } if (doGenerateXmlReport) { XMLReporter.create(context, sessionId).generateReport(); } log.info("END: Export report"); } catch (JRException | IOException e) { log.error("Error during report rendering", e); throw new TechnicalException(e); } }
JasperExportManager.exportReportToHtmlFile(jp, reportFileLocation); File htmlFile = new File(reportFileLocation); reportResponse.setReportFile(htmlFile);
break; case html: JasperExportManager.exportReportToHtmlFile(jasperPrint,destFileName); reportName = createZip(destFileName); break;
case XHTML: case HTML: JasperExportManager.exportReportToHtmlFile(jasperPrint, destinationFileName); break; case CSV: