From: satomichan Date: Sun, 27 Dec 2020 21:59:20 +0000 (+0900) Subject: ・緑黄色野菜 修正 X-Git-Tag: JAR_2020-12-28_0625_BUILD X-Git-Url: https://satomichan.jp/gitweb/?a=commitdiff_plain;h=d41ccb85e1e04005a405e92e2028d123c1cde36e;p=nucalgen ・緑黄色野菜 修正 ・「脂肪酸成分表」対応 --- diff --git a/src/main/java/jp/satomichan/nucalgen/MextStdFoodCompTable.java b/src/main/java/jp/satomichan/nucalgen/MextStdFoodCompTable.java index d851248..ec67188 100644 --- a/src/main/java/jp/satomichan/nucalgen/MextStdFoodCompTable.java +++ b/src/main/java/jp/satomichan/nucalgen/MextStdFoodCompTable.java @@ -87,16 +87,17 @@ public class MextStdFoodCompTable { } //CELL + + //食品群(1~18)書き込み compRow.createCell(62).setCellValue(group); - //緑黄色野菜か? - if(brightColoredVegetablesXmlFileName.length() > 0) { - boolean isBrightColored = false; + boolean isBrightColored = false; + if(group == 6 && brightColoredVegetablesXmlFileName.length() > 0) { String foodName = thisRow.getCell(3).getStringCellValue(); for(String aBright : this.brightColoredVegetableList) { - if(foodName.matches(aBright + ".*")) { + if(foodName.matches(".*" + aBright + ".*")) { isBrightColored = true; break; } diff --git a/src/main/java/jp/satomichan/nucalgen/Nucalgen.java b/src/main/java/jp/satomichan/nucalgen/Nucalgen.java index 9f90056..313d755 100644 --- a/src/main/java/jp/satomichan/nucalgen/Nucalgen.java +++ b/src/main/java/jp/satomichan/nucalgen/Nucalgen.java @@ -55,8 +55,8 @@ public class Nucalgen { if(cmd.hasOption("use-processed-table") == false) { //成分表 変換 - MextStdFoodCompTable moe = new MextStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list")); - moe.processInto(outputWorkbook); + MextStdFoodCompTable stdCompTable = new MextStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list")); + stdCompTable.processInto(outputWorkbook); } @@ -108,7 +108,7 @@ public class Nucalgen { String div100 = aColumn.isUseRawValue() ? "" : "/ 100 * $D" + (rowIndex + 1); - thisCell.setCellFormula("IFERROR(VLOOKUP($B" + (rowIndex + 1) + ",成分表!$B$12:$BL$2500,MATCH(\"" + aColumn.getName() + "\",成分表!$B$11:$BL$11,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++; } diff --git a/src/main/java/jp/satomichan/nucalgen/NutritionColumn.java b/src/main/java/jp/satomichan/nucalgen/NutritionColumn.java index 34d7ee3..d548f25 100644 --- a/src/main/java/jp/satomichan/nucalgen/NutritionColumn.java +++ b/src/main/java/jp/satomichan/nucalgen/NutritionColumn.java @@ -2,6 +2,7 @@ package jp.satomichan.nucalgen; public class NutritionColumn { private String name; + private String table; private String dispName; private String format; private String unit; @@ -18,6 +19,14 @@ public class NutritionColumn { this.name = name; } + public String getTable() { + return table; + } + + public void setTable(String table) { + this.table = table; + } + public void setName(Object name) { this.name = (String) name; } diff --git a/src/main/java/jp/satomichan/nucalgen/NutritionColumnHolder.java b/src/main/java/jp/satomichan/nucalgen/NutritionColumnHolder.java index e20d799..78c4fd9 100644 --- a/src/main/java/jp/satomichan/nucalgen/NutritionColumnHolder.java +++ b/src/main/java/jp/satomichan/nucalgen/NutritionColumnHolder.java @@ -21,6 +21,7 @@ public class NutritionColumnHolder { this.nutritionColumnList = new ArrayList(); List names = aConfig.getList("cols.column.name"); + List tables = aConfig.getList("cols.column.table"); List dispNames = aConfig.getList("cols.column.disp_name"); List aliases = aConfig.getList("cols.column.alias"); List formats = aConfig.getList("cols.column.format"); @@ -31,6 +32,7 @@ public class NutritionColumnHolder { for (Object aName : names) { NutritionColumn nc = new NutritionColumn(); nc.setName((String) aName); + nc.setTable((String) tables.get(names.indexOf(aName))); nc.setDispName((String) dispNames.get(names.indexOf(aName))); nc.setAlias((String) aliases.get(names.indexOf(aName))); nc.setFormat((String) formats.get(names.indexOf(aName)));