}
private static void shiftXSSFFormulas(PtgShifter shifter, int sheetIndex, XSSFCell cell, XSSFWorkbook book) {
CTCell ctCell = cell.getCTCell();
if (ctCell.isSetF()) {
CTCellFormula f = ctCell.getF();
String formula = f.getStringValue();
if (formula.length() > 0) {
String shiftedFormula = shiftXSSFFormula(book, sheetIndex, formula, shifter);
if (shiftedFormula != null) {
f.setStringValue(shiftedFormula);
}
}
if (f.isSetRef()) { //Range of cells which the formula applies to.
String ref = f.getRef();
String shiftedRef = shiftXSSFFormula(book, sheetIndex, ref, shifter);
if (shiftedRef != null) f.setRef(shiftedRef);
}
}
}