2 * Copyright 2014 Hanei Management Co.,Ltd.
4 * This file is part of Jaxcel
6 * Jaxcel is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * Jaxcel is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package org.hanei.jaxcel.util;
22 import java.io.FileInputStream;
23 import java.io.InputStreamReader;
24 import java.util.HashMap;
25 import net.arnx.jsonic.JSON;
26 import org.hanei.jaxcel.report.ReportMaker;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
31 * Excel帳票出力コマンドラインツールクラス
34 * @author Noboru Saito
36 public class MakeReportTool {
38 private static final Logger log = LoggerFactory.getLogger(MakeReportTool.class);
41 * ExcelテンプレートファイルにJSONファイルのデータを挿入することでExcel帳票を生成、Excel帳票ファイルを出力する。<br>
43 * @param args arg1: Excelテンプレートファイルパス<br>
44 * arg2: パラメータJSONファイルパス<br>
45 * arg3: Excel帳票出力ファイルパス
49 public static void main(String[] args) throws Exception {
51 if(args.length != 3) {
52 System.out.println("illegal arguments.");
53 System.out.println("arg1: template excel file path");
54 System.out.println("arg2: parameters json file path");
55 System.out.println("arg3: output excel file path");
56 System.out.println("...relative path from the build root. or absolute path");
60 HashMap<String, Object> parameter = JSON.decode(new InputStreamReader(new FileInputStream(new File(args[1])),"UTF-8"));
62 ReportMaker maker = new ReportMaker();
63 log.info("====== makeReport Start ======");
64 maker.makeReport(new File(args[0]), parameter, new File(args[2]));
65 System.out.println("output complate: " + args[2]);
66 log.info("====== makeReport End ======");