pfbBalanceRow1.createCell(4).setCellValue("F");
pfbBalanceRow1.createCell(5).setCellValue("C");
- final String sumPfc = "(" + _namedAreaMap.get("SUM_P") + "*4+" + _namedAreaMap.get("SUM_F") + "*9+" + _namedAreaMap.get("SUM_C") + "*4)";
+ final String sumKiloCalorieCell = _namedAreaMap.get("SUM_KCAL");
rowIndex++;
Row pfbBalanceRow2 = calcSheet.createRow(rowIndex);
Cell pCell = pfbBalanceRow2.createCell(3);
pCell.setCellStyle(csPool.getCellStyle("0"));
- pCell.setCellFormula(_namedAreaMap.get("SUM_P") + "*4*100/" + sumPfc);
+ pCell.setCellFormula("ROUND(" + _namedAreaMap.get("SUM_P") + "*4*100/" + sumKiloCalorieCell + ",0)");
Cell fCell = pfbBalanceRow2.createCell(4);
fCell.setCellStyle(csPool.getCellStyle("0"));
- fCell.setCellFormula(_namedAreaMap.get("SUM_F") + "*9*100/" + sumPfc);
+ fCell.setCellFormula("ROUND(" + _namedAreaMap.get("SUM_F") + "*9*100/" + sumKiloCalorieCell + ",0)");
+
Cell cCell = pfbBalanceRow2.createCell(5);
cCell.setCellStyle(csPool.getCellStyle("0"));
- cCell.setCellFormula(_namedAreaMap.get("SUM_C") + "*4*100/" + sumPfc);
+ cCell.setCellFormula("100 - (" + new CellReference(cCell.getRowIndex(), 3).formatAsString() + " + "
+ + new CellReference(cCell.getRowIndex(), 4).formatAsString() + ")");
return rowIndex;
}