private List < Integer > buildFormWatchList ( final XSSFEvaluationWorkbook wbWrapper , final Sheet sheet ) { List < Integer > watchList = new ArrayList <> ( ) ; ConfigRange cRange = this . getConfigRange ( ) ; List < ConfigCommand > commandList = cRange . getCommandList ( ) ; if ( commandList . isEmpty ( ) ) { // if no command then no dynamic changes. then no need formula // shifts. return watchList ; } int lastStaticRow = commandList . get ( 0 ) . getTopRow ( ) - 1 ; if ( lastStaticRow < 0 ) { lastStaticRow = this . getTopRow ( ) ; } int sheetIndex = sheet . getWorkbook ( ) . getSheetIndex ( sheet ) ; for ( int i = this . getTopRow ( ) ; i <= this . getLastRow ( ) ; i ++ ) { Row row = sheet . getRow ( i ) ; for ( Cell cell : row ) { if ( cell . getCellTypeEnum ( ) == CellType . FORMULA ) { buildWatchListForCell ( wbWrapper , sheetIndex , cell , watchList , lastStaticRow ) ; } } } return watchList ; }
Watch list serve for formula changes . Basically all the rows appeared in the formula in the current sheet will be watched . Note if the cell reference is from other sheet or workbooks it will be ignored .