+
+
+
+
+
+ //「栄養価計算」シート生成
+ private static void generateCalculationSheet(Workbook book, String sheetName, NamedAreaStore namedArea, boolean setProtect,
+ String[] additionOptionValues, final int lines,
+ NutritionColumnHolder nch, CellStylePool csPool, List<String> usedTableList) {
+
+
+ Sheet calcSheet = book.createSheet(sheetName);
+
+ if(setProtect) {
+ calcSheet.protectSheet("");
+ }
+ calcSheet.setColumnWidth(COL_INDEX_START -2, 10240); //C「食品名」列
+ calcSheet.addMergedRegion(new CellRangeAddress(ROW_INDEX_START -2, ROW_INDEX_START -1,
+ COL_INDEX_START -3, COL_INDEX_START -3)); //B2:B3「食品番号」セル
+
+
+ //「タイトル」行
+ Row titleRow = calcSheet.createRow(ROW_INDEX_START -2);
+ titleRow.createCell(COL_INDEX_START -3).setCellValue("食品番号");
+ titleRow.createCell(COL_INDEX_START -2).setCellValue("食品名");
+ titleRow.createCell(COL_INDEX_START -1).setCellValue("摂取量");
+ int colIndex = COL_INDEX_START;
+ for(NutritionColumn aColumn : nch.getNutritionColumnList()) {
+ titleRow.createCell(colIndex).setCellValue(aColumn.getDispName());
+ colIndex++;
+ }
+
+ //「単位」行
+ Row unitRow = calcSheet.createRow(ROW_INDEX_START -1);
+ unitRow.createCell(COL_INDEX_START -2).setCellValue("単位");
+ unitRow.createCell(COL_INDEX_START -1).setCellValue("g");
+ colIndex = COL_INDEX_START;
+ for(NutritionColumn aColumn : nch.getNutritionColumnList()) {
+ unitRow.createCell(colIndex).setCellValue(aColumn.getUnit());
+ colIndex++;
+ }
+
+ //「栄養計算」行
+ int rowIndex = ROW_INDEX_START;
+ for(int i = rowIndex; i < lines + ROW_INDEX_START; i++,rowIndex++) {
+ Row thisRow = calcSheet.createRow(rowIndex);
+
+ //「食品名」
+ thisRow.createCell(COL_INDEX_START -3).setCellStyle(csPool.getCellStyle("00000", false));
+ thisRow.createCell(COL_INDEX_START -2).setCellFormula("IFERROR(VLOOKUP(B" + (rowIndex + 1) +
+ ",成分表!$B$13:$BL$2500,3,FALSE),\"\")");
+ thisRow.createCell(COL_INDEX_START -1).setCellStyle(csPool.getCellStyle("", false));
+