Package net.sf.jasperreports.engine.export

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


            if (jp.getPages().size() < 1) {
                throw new ViewHandlerException("Report is Empty (no results?)");
            } else {
                Debug.logInfo("Got report, there are " + jp.getPages().size() + " pages.", module);
            }
           JExcelApiExporter exporter = new JExcelApiExporter();
           exporter.setParameter(JExcelApiExporterParameter.JASPER_PRINT, jp);
           exporter.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, response.getOutputStream());
           exporter.exportReport();

        } catch (IOException ie) {
            throw new ViewHandlerException("IO Error in report", ie);
        } catch (java.sql.SQLException e) {
            throw new ViewHandlerException("Database error while running report", e);
View Full Code Here


    }
   
    if(exporter == null) {
      if (format.equalsIgnoreCase("csv")) exporter = new JRCsvExporter();
      else if (format.equalsIgnoreCase("html")) exporter = new JRHtmlExporter();
      else if (format.equalsIgnoreCase("xls")) exporter = new JExcelApiExporter(); //exporter = new JRXlsExporter();
      else if (format.equalsIgnoreCase("rtf")) exporter = new JRRtfExporter();
      else if (format.equalsIgnoreCase("xml")) exporter = new JRXmlExporter();
      else if (format.equalsIgnoreCase("txt")) exporter = new JRTextExporter();
      else if (format.equalsIgnoreCase("pdf")) exporter = new JRPdfExporter();  
      else if (format.equalsIgnoreCase("JPG"))exporter = new JRJpegExporter();
View Full Code Here

    } else if (outputType.equalsIgnoreCase("application/pdf"))  {     
         exporter = new JRPdfExporter();  
    } else if (outputType.equalsIgnoreCase("application/rtf"))  {     
         exporter = new JRRtfExporter();    
    } else if (outputType.equalsIgnoreCase("application/vnd.ms-excel")) {
         exporter = new JExcelApiExporter();
    } else {
         exporter = new JRPdfExporter();
    }
     
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
View Full Code Here

            if (jp.getPages().size() < 1) {
                throw new ViewHandlerException("Report is Empty (no results?)");
            } else {
                Debug.logInfo("Got report, there are " + jp.getPages().size() + " pages.", module);
            }
           JExcelApiExporter exporter = new JExcelApiExporter();
           exporter.setParameter(JExcelApiExporterParameter.JASPER_PRINT, jp);
           exporter.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, response.getOutputStream());
           exporter.exportReport();

        } catch (IOException ie) {
            throw new ViewHandlerException("IO Error in report", ie);
        } catch (java.sql.SQLException e) {
            throw new ViewHandlerException("Database error while running report", e);
View Full Code Here

    } else if (outputType.equalsIgnoreCase("application/pdf"))  {     
         exporter = new JRPdfExporter();  
    } else if (outputType.equalsIgnoreCase("application/rtf"))  {     
         exporter = new JRRtfExporter();    
    } else if (outputType.equalsIgnoreCase("application/vnd.ms-excel")) {
         exporter = new JExcelApiExporter();
    } else {
         exporter = new JRPdfExporter();
    }
    return exporter;
  }
View Full Code Here

        */
      } else if (outputType.equalsIgnoreCase("xls")) {
        if(mimeType == null) mimeType = "application/vnd.ms-excel";
        servletResponse.setContentType(mimeType);
        //if(exporter == null) exporter = new JRXlsExporter();
        if(exporter == null) exporter = new JExcelApiExporter();
      } else if (outputType.equalsIgnoreCase("rtf")) {
        if(mimeType == null) mimeType = "application/rtf";
        servletResponse.setContentType(mimeType);
        if(exporter == null) exporter = new JRRtfExporter();
      } else if (outputType.equalsIgnoreCase("xml")) {
View Full Code Here

  public static void createXLSReport(InputStream reportFile, GridReportVO gridReportVO,
      String path, String fileName) throws JRException, IOException {
    gridReportVO.setPagination(true);
    JasperPrint jasperPrint = createJasperPrint(reportFile, gridReportVO);
    JExcelApiExporter exporter = new JExcelApiExporter();
    Map<JRExporterParameter, Object> p = new HashMap<JRExporterParameter, Object>();

    p.put(JRExporterParameter.JASPER_PRINT, jasperPrint);
    p.put(JRExporterParameter.OUTPUT_FILE_NAME, path + "/" + fileName);
    p.put(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
    p.put(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
    p.put(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);

    exporter.setParameters(p);
    exporter.exportReport();
  }
View Full Code Here

      } else if (strOutputType.equals("xls")) {
        // response.setContentType("application/vnd.ms-excel");
        // response.setHeader( "Content-disposition", "attachment" +
        // "; filename=" + strFileName + "." +strOutputType);
        JExcelApiExporter exporter = new JExcelApiExporter();
        exportParameters.put(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exportParameters.put(JRExporterParameter.OUTPUT_STREAM, os);
        exportParameters.put(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
        exportParameters.put(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
            Boolean.TRUE);

        exporter.setParameters(exportParameters);
        exporter.exportReport();

      } else {
        throw new ServletException("Output format no supported");
      }
    } catch (JRException e) {
View Full Code Here

    final String outputFile = globalParameters.strFTPDirectory + "/" + fileName;
    final String reportType = fileName.substring(fileName.lastIndexOf(".") + 1);
    if (reportType.equalsIgnoreCase("pdf")) {
      JasperExportManager.exportReportToPdfFile(jp, outputFile);
    } else if (reportType.equalsIgnoreCase("xls")) {
      JExcelApiExporter exporter = new JExcelApiExporter();
      exportParameters.put(JRExporterParameter.JASPER_PRINT, jp);
      exportParameters.put(JRExporterParameter.OUTPUT_FILE_NAME, outputFile);
      exportParameters.put(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
      exportParameters.put(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
          Boolean.TRUE);
      exportParameters.put(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, true);
      exporter.setParameters(exportParameters);
      exporter.exportReport();
    } else {
      throw new JRException("Report type not supported");
    }

  }
View Full Code Here

TOP

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

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.