/** * Return a formula for the cell, for example, <code>SUM(C4:E4)</code> * * @return a formula for the cell * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is not CELL_TYPE_FORMULA */ public String getCellFormula(Cell _cell) { int cellType = CellUtils.getCellType(_cell); if(cellType != CellUtils.CELL_TYPE_FORMULA) throw CellUtils.typeMismatch(CellUtils.CELL_TYPE_FORMULA, cellType, false); CTCellFormula f = _cell.getF(); // if (isPartOfArrayFormulaGroup() && f == null) { // Cell cell = getSheet().getFirstCellInArrayFormula(this); // return cell.getCellFormula(); // } if (f==null) { throw new RuntimeException("TODO: handle isPartOfArrayFormulaGroup()"); } if (f.getT() == STCellFormulaType.SHARED) { //return convertSharedFormula((int)f.getSi()); throw new RuntimeException("TODO: convertSharedFormula"); } return f.getValue(); }
/** * Return a formula for the cell, for example, <code>SUM(C4:E4)</code> * * @return a formula for the cell * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is not CELL_TYPE_FORMULA */ public String getCellFormula(Cell _cell) { int cellType = CellUtils.getCellType(_cell); if(cellType != CellUtils.CELL_TYPE_FORMULA) throw CellUtils.typeMismatch(CellUtils.CELL_TYPE_FORMULA, cellType, false); CTCellFormula f = _cell.getF(); // if (isPartOfArrayFormulaGroup() && f == null) { // Cell cell = getSheet().getFirstCellInArrayFormula(this); // return cell.getCellFormula(); // } if (f==null) { throw new RuntimeException("TODO: handle isPartOfArrayFormulaGroup()"); } if (f.getT() == STCellFormulaType.SHARED) { //return convertSharedFormula((int)f.getSi()); throw new RuntimeException("TODO: convertSharedFormula"); } return f.getValue(); }