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>
45 * <li>arg1 [必須]: Excelテンプレートファイルパス</li>
46 * <li>arg2 [必須]: パラメータJSONファイルパス</li>
47 * <li>arg3 [必須]: Excel帳票出力ファイルパス</li>
48 * <li>arg4 [任意]: カスタムプロパティファイルパス</li>
53 public static void main(String[] args) throws Exception {
59 System.out.println("illegal arguments.");
60 System.out.println("arg1 [required] : template excel file path");
61 System.out.println("arg2 [required] : parameters json file path");
62 System.out.println("arg3 [required] : output excel file path");
63 System.out.println("arg4 [option] : custom property file path");
64 System.out.println("...relative path from the build root. or absolute path");
69 HashMap<String, Object> parameter = JSON.decode(new InputStreamReader(new FileInputStream(new File(args[1])), "UTF-8"));
71 // creation ReportMaker
72 if(args.length >= 4) {
73 maker = new ReportMaker(new File(args[3]));
76 maker = new ReportMaker();
80 log.info("====== makeReport Start ======");
81 maker.makeReport(new File(args[0]), parameter, new File(args[2]));
82 System.out.println("output complate: " + args[2]);
83 log.info("====== makeReport End ======");