Package net.sf.jasperreports.engine.design

Examples of net.sf.jasperreports.engine.design.JasperDesign


      else if (fileName.endsWith(".jrxml")) {
        // Compile report on-the-fly.
        if (logger.isInfoEnabled()) {
          logger.info("Compiling Jasper Report loaded from " + resource);
        }
        JasperDesign design = JRXmlLoader.load(resource.getInputStream());
        return getReportCompiler().compileReport(design);
      }
      else {
        throw new IllegalArgumentException(
            "Report filename [" + fileName + "] must end in either .jasper or .jrxml");
View Full Code Here


        InputStream templateInputStream = new ByteArrayInputStream(templateBytes);
        JasperPrint jasperPrint;
        HashMap map;
        try {
            // load JasperDesign
            JasperDesign jasperDesign = JRXmlLoader.load(templateInputStream);
            // compiling JasperDesign from JasperCompileManager
            JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
            // generate JasperPrint Object from given JasperReport file and JRDataSource
            // by JasperFillManager
            try {
View Full Code Here

        byte[] templateBytes = template.getBytes();
        InputStream templateInputStream = new ByteArrayInputStream(templateBytes);
        JasperPrint jasperPrint;
        try {
            // load JasperDesign
            JasperDesign jasperDesign = JRXmlLoader.load(templateInputStream);
            // compiling JasperDesign from JasperCompileManager
            JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
            // generate JasperPrint Object from given JasperReport file and JRDataSource by JasperFillManager
            jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), jrDataSource);
        } catch (JRException e) {
View Full Code Here

            JasperReport jr;
          
            InputStream in = getClass().getResourceAsStream(resourcefile + ".ser");
            if (in == null) {     
                // read and compile the report
                JasperDesign jd = JRXmlLoader.load(getClass().getResourceAsStream(resourcefile + ".jrxml"));           
                jr = JasperCompileManager.compileReport(jd);   
            } else {
                // read the compiled reporte
                ObjectInputStream oin = new ObjectInputStream(in);
                jr = (JasperReport) oin.readObject();
View Full Code Here

            JasperReport jr;
          
            InputStream in = getClass().getResourceAsStream(resourcefile + ".ser");
            if (in == null) {     
                // read and compile the report
                JasperDesign jd = JRXmlLoader.load(getClass().getResourceAsStream(resourcefile + ".jrxml"));           
                jr = JasperCompileManager.compileReport(jd);   
            } else {
                // read the compiled reporte
                ObjectInputStream oin = new ObjectInputStream(in);
                jr = (JasperReport) oin.readObject();
View Full Code Here

        if (logger.isInfoEnabled()) {
          logger.info("Compiling Jasper Report loaded from " + resource);
        }
        InputStream is = resource.getInputStream();
        try {
          JasperDesign design = JRXmlLoader.load(is);
          return JasperCompileManager.compileReport(design);
        }
        finally {
          is.close();
        }
View Full Code Here

          if (logger.isInfoEnabled()) {
            logger.info("Compiling Jasper Report loaded from " + resource);
          }
          InputStream is = resource.getInputStream();
          try {
            JasperDesign design = JRXmlLoader.load(is);
            return JasperCompileManager.compileReport(design);
          }
          finally {
            is.close();
          }
View Full Code Here

 
  /**
   * default jasper design
   */
  public void newJasperDesign( ) throws JRException{
    JasperDesign jasperDesign = new JasperDesign( );
   
    jasperDesign.setName("DefaultReport");
    jasperDesign.setPageWidth( PAGE_A4[ WIDTH ] );
    jasperDesign.setPageHeight( PAGE_A4[ HEIGHT ] );
    jasperDesign.setColumnWidth(50);
    //jasperDesign.setColumnSpacing(5);     
    jasperDesign.setTopMargin( PAGE_MARGIN[ TOP ] );
    jasperDesign.setRightMargin( PAGE_MARGIN[ RIGHT ] );
    jasperDesign.setBottomMargin( PAGE_MARGIN[ BOTTOM ] );
    jasperDesign.setLeftMargin( PAGE_MARGIN[ LEFT ] )

    //normal style
    JRDesignStyle normalStyle = new JRDesignStyle();
    normalStyle.setName( DEFAULT_STYLE_NAME );
    normalStyle.setDefault(true);
    //normalStyle.setFontName("Arial");
    normalStyle.setFontName(getAvailableFontFamilyName("宋体"));
    normalStyle.setFontSize(10);
    normalStyle.setPdfFontName("STSong-Light");
    normalStyle.setPdfEncoding("UniGB-UCS2-H");
    normalStyle.setPdfEmbedded( true )
    normalStyle.setHorizontalAlignment( HorizontalAlignEnum.JUSTIFIED);
       
    //title style
    JRDesignStyle titleStyle = new JRDesignStyle();
    titleStyle.setName( TITLE_STYLE_NAME );
    titleStyle.setDefault(false);
    titleStyle.setFontName(getAvailableFontFamilyName("Arial"));
    titleStyle.setFontSize(10);
    titleStyle.setPdfFontName("STSong-Light");
    titleStyle.setPdfEncoding("UniGB-UCS2-H");
    titleStyle.setPdfEmbedded( true )
    titleStyle.setHorizontalAlignment( HorizontalAlignEnum.LEFT )
    titleStyle.setForecolor( Color.LIGHT_GRAY );
   
    //caption style
    JRDesignStyle captionStyle = new JRDesignStyle();
    captionStyle.setName( CAPTION_STYLE_NAME );
    captionStyle.setDefault(false);
    captionStyle.setFontName(getAvailableFontFamilyName("Arial"));
    captionStyle.setFontSize(10);
    captionStyle.setPdfFontName("STSong-Light");
    captionStyle.setPdfEncoding("UniGB-UCS2-H");
    captionStyle.setPdfEmbedded( true )
    captionStyle.setHorizontalAlignment( HorizontalAlignEnum.LEFT )
    //captionStyle.setForecolor( Color.ORANGE );
    captionStyle.setBold( true );
    //captionStyle.setBackcolor( Color.LIGHT_GRAY );
   
    //column header style
       
    jasperDesign.addStyle(normalStyle);
    jasperDesign.addStyle(titleStyle);
    jasperDesign.addStyle(captionStyle);
   
    this.design = jasperDesign;
  }
View Full Code Here

      else if (fileName.endsWith(".jrxml")) {
        // Compile report on-the-fly.
        if (logger.isInfoEnabled()) {
          logger.info("Compiling Jasper Report loaded from " + resource);
        }
        JasperDesign design = JRXmlLoader.load(resource.getInputStream());
        return getReportCompiler().compileReport(design);
      }
      else {
        throw new IllegalArgumentException(
            "Report URL [" + getUrl() + "] must end in either .jasper or .jrxml");
View Full Code Here

      else if (fileName.endsWith(".jrxml")) {
        // Compile report on-the-fly.
        if (logger.isInfoEnabled()) {
          logger.info("Compiling Jasper Report loaded from " + resource);
        }
        JasperDesign design = JRXmlLoader.load(resource.getInputStream());
        return getReportCompiler().compileReport(design);
      }
      else {
        throw new IllegalArgumentException(
            "Report URL [" + getUrl() + "] must end in either .jasper or .jrxml");
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.design.JasperDesign

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.