Package net.sf.jasperreports.engine.export

Examples of net.sf.jasperreports.engine.export.JRHtmlExporter


 
  Logger.debug(this, "Call to fillReport with Data Source: " + report.getDs());
  JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, DbConnectionFactory.getConnection(report.getDs()));
 
  Logger.debug(this, "Creating exporter");
  JRHtmlExporter exporter = new JRHtmlExporter();
 
  Logger.debug(this, "Getting pages");
  int lastPageIndex = 0;
  if (jasperPrint.getPages() != null) {
      lastPageIndex = jasperPrint.getPages().size() - 1;
  }
 
  if (!(pageIndex >= 0)) {
      pageIndex = 0;
  }
 
  if (pageIndex > lastPageIndex) {
      pageIndex = lastPageIndex;
  }
 
  StringBuffer sbuffer = new StringBuffer();
 
  request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,jasperPrint);

  Logger.debug(this, "Setting parameters");
  exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
  exporter.setParameter(JRExporterParameter.OUTPUT_STRING_BUFFER,  sbuffer);
  if (jasperPrint.getPages() != null && jasperPrint.getPages().size()>0){
      exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
  }
  exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, "");
  exporter.setParameter(JRHtmlExporterParameter.BETWEEN_PAGES_HTML, "");
  exporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER, "");
  exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "/servlets/jrimage?image=");
 
  request.getSession().setAttribute(BaseHttpServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,jasperPrint);
 
  Logger.debug(this, "Exporting report");
  exporter.exportReport();
  request.setAttribute("reportSB", sbuffer);
  request.setAttribute("pageIndex", pageIndex);
  request.setAttribute("lastPageIndex", lastPageIndex);
  request.setAttribute("reportId", report.getInode());
  request.setAttribute("submittedPars", submittedPars);
View Full Code Here


          exporterCSV.setParameter(JRCsvExporterParameter.OUTPUT_STREAM, outputStream);
          exporterCSV.exportReport();
          break;
        case HTML:
          logger.debug(bundle.getString("exporting-report", "html"));
          JRHtmlExporter exporterHTML = new JRHtmlExporter();
          exporterHTML.setParameter(JRHtmlExporterParameter.JASPER_PRINT, print);
          exporterHTML.setParameter(JRHtmlExporterParameter.OUTPUT_STREAM, outputStream);
          exporterHTML.exportReport();
          break;
        case ODT:
          logger.debug(bundle.getString("exporting-report", "odt"));
          JROdtExporter exporterODT = new JROdtExporter();
          exporterODT.setParameter(JRExporterParameter.JASPER_PRINT, print);
View Full Code Here

            case "PDF":
                exporter = new JRPdfExporter();
                log.info("Starting PDF report generation.");
                break;
            default:
                exporter = new JRHtmlExporter();
                log.info("Starting HTML report generation.");

                if (reportFormat == ReportFormat.VULNERABILITY_PROGRESS_BY_TYPE) {
                    parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
                }
View Full Code Here

          exporterCSV.setParameter(JRCsvExporterParameter.OUTPUT_STREAM, outputStream);
          exporterCSV.exportReport();
          break;
        case HTML:
          logger.debug(bundle.getString("exporting-report", "html"));
          JRHtmlExporter exporterHTML = new JRHtmlExporter();
          exporterHTML.setParameter(JRHtmlExporterParameter.JASPER_PRINT, print);
          exporterHTML.setParameter(JRHtmlExporterParameter.OUTPUT_STREAM, outputStream);
          exporterHTML.exportReport();
          break;
        case ODT:
          logger.debug(bundle.getString("exporting-report", "odt"));
          JROdtExporter exporterODT = new JROdtExporter();
          exporterODT.setParameter(JRExporterParameter.JASPER_PRINT, print);
View Full Code Here

    JasperExportManager.exportReportToPdfFile(jasperPrint, destinationFolder + File.separatorChar + reportName
        + "." + EXPORT_FORMAT.PDF.toString().toLowerCase());
  }

  private void exportHTML(String destinationFolder, String reportName, JasperPrint jasperPrint) throws JRException {
    JRHtmlExporter exporter = new JRHtmlExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destinationFolder + File.separatorChar + reportName
        + "." + EXPORT_FORMAT.HTML.toString().toLowerCase());
    exporter.setParameter(JRHtmlExporterParameter.IGNORE_PAGE_MARGINS, true);
    exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, true);
    exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, false);
    exporter.exportReport();
  }
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.export.JRHtmlExporter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.