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"));
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("栄養価計算");
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;
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");