如何编译jrxml以获取jasper? [英] How do I compile jrxml to get jasper?

查看:265
本文介绍了如何编译jrxml以获取jasper?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 jrxml 文件,我想编译它以获取 .jasper 。如何编译并获取 jasper 文件?

解决方案

那里有三种方法可以将jrxml编译为jasper。


  1. 您可以通过iReport设计器上的编译按钮(锤子徽标)直接编译。


  2. 您可以使用ant进行编译,如:


  3. 您还可以使用 JasperCompileManager 类从您的Java代码进行编译。

      JasperCompileManager.compileReportToFile(
    our_jasper_template.jrxml,//用于编译$ b $的jrxml文件的路径b our_compiled_template.jasper); //我们要将编译文件保存到
    的路径和名称



I have jrxml file, I want to compile this to get .jasper. How do I compile and get that jasper file?

解决方案

There are three ways to compile jrxml to jasper.

  1. You can do direct compile via compile button (hammer logo) on iReport designer.

  2. You can use ant to compile as shown in the Ant Compile Sample.

    <target name="compile1"> 
      <mkdir dir="./build/reports"/> 
      <jrc 
        srcdir="./reports"
        destdir="./build/reports"
        tempdir="./build/reports"
        keepjava="true"
        xmlvalidation="true">
       <classpath refid="runClasspath"/>
       <include name="**/*.jrxml"/>
      </jrc>
    </target>
    

    Below is the report compile task on my current project.

    addition from Daniel Rikowski :

  3. You can also use the JasperCompileManager class to compile from your java code.

    JasperCompileManager.compileReportToFile(
                    our_jasper_template.jrxml",//the path to the jrxml file to compile
                    our_compiled_template.jasper");//the path and name we want to save the compiled file to
    

这篇关于如何编译jrxml以获取jasper?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆