/** * Sets formula for this cell. * * <p>Note, this method only sets the formula string and does not calculate the formula value. To * set the precalculated value use {@link #setCellValue(double)} or {@link #setCellValue(String)} * * @param formula the formula to set, e.g. <code>"SUM(C4:E4)"</code>. If the argument is <code> * null</code> then the current formula is removed. * @throws FormulaParseException if the formula has incorrect syntax or is otherwise invalid */ public void setCellFormula(String formula) throws FormulaParseException { if (formula == null) { setType(Cell.CELL_TYPE_BLANK); return; } ensureFormulaType(computeTypeFromFormula(formula)); ((FormulaValue) _value).setValue(formula); }