}
}
}
private void copyFormula(Formula formula, Cell cell) {
final SSExpression expr = (SSExpression) formula.parse(newXelContext());
final List ranges = expr.getRanges();
if (ranges.isEmpty()) { //no reference formula, reuse the original formula
cell.setValue(formula);
} else {
final int coloff = cell.getColumn() - getColumn();
final int rowoff = cell.getRow() - getRow();
final SSExpression clone = expr.clone(cell.getSheet(), rowoff, coloff);
cell.setValue(new FormulaImpl(clone));
}
}