private void buildWatchListForCell ( final XSSFEvaluationWorkbook wbWrapper , final int sheetIndex , final Cell cell , final List < Integer > watchList , final int lastStaticRow ) { String formula = cell . getCellFormula ( ) ; Ptg [ ] ptgs = FormulaParser . parse ( formula , wbWrapper , FormulaType . CELL , sheetIndex ) ; for ( int k = 0 ; k < ptgs . length ; k ++ ) { Object ptg = ptgs [ k ] ; // For area formula, only first row is watched. // Reason is the lastRow must shift same rows with // firstRow. // Otherwise it's difficult to calculate. // In case some situation cannot fit, then should make // change to the formula. int areaInt = ShiftFormulaUtility . getFirstSupportedRowNumFromPtg ( ptg ) ; if ( areaInt >= 0 ) { addToWatchList ( areaInt , lastStaticRow , watchList ) ; } } // when insert row, the formula may changed. so here is the // workaround. // change formula to user formula to preserve the row // changes. cell . setCellType ( CellType . STRING ) ; cell . setCellValue ( TieConstants . USER_FORMULA_PREFIX + formula + TieConstants . USER_FORMULA_SUFFIX ) ; }
Builds the watch list for cell .