Subversion Repository Public Repository

Pharmacy_09_03_18

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcarecommonutil.report;

import com.bestray.healthcarecommonutil.exception.HealthCareException;
import java.io.OutputStream;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRPdfExporterParameter;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.JRXlsExporterParameter;

// TODO: Auto-generated Javadoc
/**
 * The Class ReportFormat.
 *
 * @author dell
 */
public class ReportFormat {
    
    /**
     * Gets the xls format.
     *
     * @param print the print
     * @param outFileName the out file name
     * @throws Exception the exception
     */
    public  void getXlsFormat(JasperPrint print,OutputStream outFileName)throws Exception{
         
       
         try{
           
            JRXlsExporter exporterXLS = new JRXlsExporter();
            exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, print);
            exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, outFileName);
            exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
            exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
            exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
            
            exporterXLS.exportReport();
            outFileName.close();
      
         }catch (Exception e) {
                throw new HealthCareException("Jasper Report Problem");
         }
      
        
     }
     
     /**
      * Gets the pdf format.
      *
      * @param print the print
      * @param outFileName the out file name
      * @throws Exception the exception
      */
     public void getPdfFormat(JasperPrint print,OutputStream outFileName)throws Exception{
         
        
         try{
            JRPdfExporter exporter=new JRPdfExporter();
            exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT, print);
            exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, outFileName);
            exporter.exportReport();
            outFileName.close();
     
         }catch (Exception e) {
                throw new HealthCareException("Jasper Report Problem");
         }
     }
    
}

Commits for Pharmacy_09_03_18/Dr Gyana ProjectSpace/DrGyanaCommonUtil/src/main/java/com/bestray/healthcarecommonutil/report/ReportFormat.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 07:30:57 +0000