Package net.sf.jasperreports.engine

Examples of net.sf.jasperreports.engine.JasperPrint


  public void xhtml() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/DataSourceReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".x.html");
   
    JRXhtmlExporter exporter = new JRXhtmlExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here


      }
      else if (TASK_RTF.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf");
       
        JRRtfExporter exporter = new JRRtfExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
       
        exporter.exportReport();

        System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_XML.equals(taskName))
      {
        JasperExportManager.exportReportToXmlFile(fileName, false);
        System.err.println("XML creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_XML_EMBED.equals(taskName))
      {
        JasperExportManager.exportReportToXmlFile(fileName, true);
        System.err.println("XML creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_HTML.equals(taskName))
      {
        JasperExportManager.exportReportToHtmlFile(fileName);
        System.err.println("HTML creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_XLS.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");
       
        JRXlsExporter exporter = new JRXlsExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
        exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
       
        exporter.exportReport();

        System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_JXL.equals(taskName))
      {
        File sourceFile = new File(fileName);

        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".jxl.xls");

        JExcelApiExporter exporter = new JExcelApiExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
        exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);

        exporter.exportReport();

        System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_CSV.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".csv");
       
        JRCsvExporter exporter = new JRCsvExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
       
        exporter.exportReport();

        System.err.println("CSV creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_ODT.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".odt");
       
        JROdtExporter exporter = new JROdtExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
       
        exporter.exportReport();

        System.err.println("ODT creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_ODS.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ods");
       
        JROdsExporter exporter = new JROdsExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
       
        exporter.exportReport();

        System.err.println("ODS creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_DOCX.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".docx");
       
        JRDocxExporter exporter = new JRDocxExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
       
        exporter.exportReport();

        System.err.println("DOCX creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_XLSX.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
       
        JRXlsxExporter exporter = new JRXlsxExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
        exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
       
        exporter.exportReport();

        System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_PPTX.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".pptx");
       
        JRPptxExporter exporter = new JRPptxExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
       
        exporter.exportReport();

        System.err.println("PPTX creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_XHTML.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".x.html");
       
        JRXhtmlExporter exporter = new JRXhtmlExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
       
        exporter.exportReport();

        System.err.println("XHTML creation time : " + (System.currentTimeMillis() - start));
      }
      else if (TASK_XML4SWF.equals(taskName))
      {
        File sourceFile = new File(fileName);
   
        JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
   
        File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xml4swf");
       
        JRXml4SwfExporter exporter = new JRXml4SwfExporter();
       
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void rtf() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");
   
    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf");
   
    JRRtfExporter exporter = new JRRtfExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void xls() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");
   
    JRXlsExporter exporter = new JRXlsExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void jxl() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".jxl.xls");

    JExcelApiExporter exporter = new JExcelApiExporter();

    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void csv() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".csv");
   
    JRCsvExporter exporter = new JRCsvExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void odt() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".odt");
   
    JROdtExporter exporter = new JROdtExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void ods() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ods");
   
    JROdsExporter exporter = new JROdsExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void docx() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".docx");
   
    JRDocxExporter exporter = new JRDocxExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

  public void xlsx() throws JRException
  {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/MarkupReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
   
    JRXlsxExporter exporter = new JRXlsxExporter();
   
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.JasperPrint

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.