Package net.sf.jasperreports.engine.export

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


      contentType = "text/html";
      exporter = new JRHtmlExporter();
      //... ...
    }else if( FORMAT_CSV.equalsIgnoreCase( type ) ){
      contentType = "text/csv";
      exporter = new JRCsvExporter();
    }else if( FORMAT_RTF.equalsIgnoreCase( type ) ){
      contentType = "application/msword";
      exporter = new JRRtfExporter();
    }else if( FORMAT_XLS.equalsIgnoreCase( type ) ){
      contentType = "application/vnd.ms-excel";
View Full Code Here


   */
  public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer)
      throws JRException {

    JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData));
    render(new JRCsvExporter(), print, writer);
  }
View Full Code Here

   */
  public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer,
      Map exporterParameters) throws JRException {

    JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData));
    JRCsvExporter exporter = new JRCsvExporter();
    exporter.setParameters(exporterParameters);
    render(exporter, print, writer);
  }
View Full Code Here

  public JasperReportsCsvView() {
    setContentType("text/csv");
  }

  protected JRExporter createExporter() {
    return new JRCsvExporter();
  }
View Full Code Here

   * @see #convertReportData
   */
  public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer)
      throws JRException {
    JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData));
    render(new JRCsvExporter(), print, writer);
  }
View Full Code Here

   * @see #convertReportData
   */
  public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer,
                   Map exporterParameters) throws JRException {
    JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData));
    JRCsvExporter exporter = new JRCsvExporter();
    exporter.setParameters(exporterParameters);
    render(exporter, print, writer);
  }
View Full Code Here

            if (format.equals(FORMAT_PDF)) {
                response.setContentType("application/pdf");
                exporter = new JRPdfExporter();
            } else if (format.equals(FORMAT_CSV)) {
                response.setContentType("text/plain");
                exporter = new JRCsvExporter();
            } else if (format.equals(FORMAT_HTML)) {
                response.setContentType("text/html");

                // IMAGES_MAPS seems to be only supported as "backward compatible" from JasperReports 1.1.0
View Full Code Here

      {
        res.addOutput("contentType", "text/plain");
        res.addOutput("fileName", "Report.csv");

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        JRExporter exporter = new JRCsvExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, buf);
        exporter.exportReport();
        outReport.setContent(buf.toByteArray());
      }
      else if ("csv".equals(reportFormat))
      {
        res.addOutput("contentType", "text/xml");
        res.addOutput("fileName", "Report.xml");

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        JRExporter exporter = new JRXmlExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, buf);
        exporter.exportReport();
        outReport.setContent(buf.toByteArray());
      }
      else if ("xls".equals(reportFormat))
      {
        res.addOutput("contentType", "application/xls");
        res.addOutput("fileName", "Report.xls");

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        JRExporter exporter = new JRXlsExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, buf);
        exporter.exportReport();
        outReport.setContent(buf.toByteArray());
      }
      else
      {
        StringBuffer buf = new StringBuffer();
        JRExporter exporter = new JRHtmlExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STRING_BUFFER, buf);
        exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, "");
        exporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER, "");
        exporter.setParameter(JRHtmlExporterParameter.BETWEEN_PAGES_HTML, "");
        exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, new Boolean(true));
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(page - 1));
        exporter.exportReport();
        outReport.setContent(buf.toString());

        createPageNavigationControls(req, res, page, reportPrint.getPages().size(), backModel);
      }
    }
View Full Code Here

  public String getExtension() {
    return "csv";
  }

  public JRExporter setup() {
    return new JRCsvExporter();
  }
View Full Code Here

            if (format.equals(FORMAT_PDF)) {
                response.setContentType("application/pdf");
                exporter = new JRPdfExporter();
            } else if (format.equals(FORMAT_CSV)) {
                response.setContentType("text/plain");
                exporter = new JRCsvExporter();
            } else if (format.equals(FORMAT_HTML)) {
                response.setContentType("text/html");

                // IMAGES_MAPS seems to be only supported as "backward compatible" from JasperReports 1.1.0
View Full Code Here

TOP

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

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.