2016年2月15日月曜日

jasper でレポート作成(デザインコンパイル)

■デザインコンパイル
$ cat jrc.java
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;

class jrc {
  public static void main(String[] args) {
    if (args.length != 2) {
      System.out.printf("Usage : java jrc src.jrcxml dst.jasper\n");
      System.exit(1);
    }

    try {
      JasperCompileManager.compileReportToFile(args[0],args[1]);
    } catch (JRException e) {
      e.printStackTrace();
    }
    System.out.printf("Done compiling[%s]!! ...\n",args[0]);
   }
}


% javac jrc.java
% ls
jrc.java  sample01.jrxml

% java jrc sample.jrxml sample.jasper
% ls 
jrc.class  jrc.java  sample01.jasper  sample01.jrxml



0 件のコメント:

コメントを投稿