・緑黄色野菜 修正
[nucalgen] / src / main / java / jp / satomichan / nucalgen / Nucalgen.java
index 902d85db4aaf939df0a35a04b29ad822efb34e21..313d755ca025cc1df3a594943c572326cfba19f9 100644 (file)
@@ -34,14 +34,14 @@ public class Nucalgen {
                options.addOption(Option.builder("groupsum").longOpt("with-group-sum").build());
                options.addOption(Option.builder("bright").hasArg().longOpt("bright-colored-vegetables-list").build());
                options.addOption(Option.builder("protect").longOpt("set-protect").build());
-               options.addOption(Option.builder("r").longOpt("use-cache-std-food-comp").build());
+               options.addOption(Option.builder("r").longOpt("-use-processed-table").build());
 
                try {
 
                        CommandLineParser parser = new DefaultParser();
                        CommandLine cmd = parser.parse(options, args);
 
-                       final String moeStdFoodCompTableFileName = cmd.getOptionValue("std-food-comp-table");
+                       final String mextStdFoodCompTableFileName = cmd.getOptionValue("std-food-comp-table");
                        final String columnsXmlFileName = cmd.getOptionValue("columns");
                        final String outputXlsxFileName = cmd.getOptionValue("output");
                        final int lines = Integer.parseInt(cmd.getOptionValue("lines"));
@@ -51,17 +51,14 @@ public class Nucalgen {
                        NutritionColumnHolder nc = new NutritionColumnHolder(config);
 
                        //Book生成
-                       Workbook outputWorkbook = WorkbookFactory.create(new FileInputStream(moeStdFoodCompTableFileName));
+                       Workbook outputWorkbook = WorkbookFactory.create(new FileInputStream(mextStdFoodCompTableFileName));
 
                        if(cmd.hasOption("use-processed-table") == false) {
-                               //「本表」変換
-                               MoeStdFoodCompTable moe = new MoeStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list"));
-                               moe.processInto(outputWorkbook);
+                               //成分表 変換
+                               MextStdFoodCompTable stdCompTable = new MextStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list"));
+                               stdCompTable.processInto(outputWorkbook);
                        }
 
-                       //「別表」削除
-                       outputWorkbook.removeSheetAt(1);
-
 
                        //「栄養価計算」シート生成
                        Sheet calcSheet = outputWorkbook.createSheet("栄養価計算");
@@ -101,7 +98,7 @@ public class Nucalgen {
                                Row thisRow = calcSheet.createRow(rowIndex);
 
                                thisRow.createCell(1).setCellStyle(csPool.getCellStyle("00000", false));
-                               thisRow.createCell(2).setCellFormula("IFERROR(VLOOKUP(B" + (rowIndex + 1) + ",æ\9c¬è¡¨!$B$9:$BS$2199,3,FALSE),\"\")");
+                               thisRow.createCell(2).setCellFormula("IFERROR(VLOOKUP(B" + (rowIndex + 1) + ",æ\88\90å\88\86表!$B$12:$BL$2500,3,FALSE),\"\")");
                                thisRow.createCell(3).setCellStyle(csPool.getCellStyle("", false));
 
                                colIndex = 4;
@@ -111,14 +108,14 @@ public class Nucalgen {
 
                                        String div100 = aColumn.isUseRawValue() ? "" :  "/ 100 * $D" + (rowIndex + 1);
 
-                                       thisCell.setCellFormula("IFERROR(VLOOKUP($B" + (rowIndex + 1) + ",本表!$B$9:$BS$2199,MATCH(\"" + aColumn.getName() + "\",本表!$B$6:$BS$6,0),FALSE) " + div100 + ",\"\")");
+                                       thisCell.setCellFormula("IFERROR(VLOOKUP($B" + (rowIndex + 1) + "," + aColumn.getTable() + "!$B$12:$BL$2500,MATCH(\"" + aColumn.getName() + "\"," + aColumn.getTable() + "!$B$11:$BL$11,0),FALSE) " + div100 + ",\"\")");
                                        colIndex++;
                                }
 
                        }
 
 
-                       //摂取量 名前付き範囲
+                       //摂取量 名前付き範囲
                        String intakeArea = new CellReference(calcSheet.getSheetName(), 3, 3, true, true).formatAsString() + ":" + new CellReference(calcSheet.getSheetName(), rowIndex -1, 3, true, true).formatAsString();
                        XSSFName intakeNamedRangeArea = (XSSFName) outputWorkbook.createName();
                        intakeNamedRangeArea.setNameName("AREA_INTAKE");