public static void removeRowsInSheet ( final Sheet sheet , final int rowIndexStart , final int rowIndexEnd , final Map < Cell , String > cachedMap ) { for ( int irow = rowIndexStart ; irow <= rowIndexEnd ; irow ++ ) { removeCachedCellForRow ( sheet , irow , cachedMap ) ; } int irows = rowIndexEnd - rowIndexStart + 1 ; if ( ( irows < 1 ) || ( rowIndexStart < 0 ) ) { return ; } int lastRowNum = sheet . getLastRowNum ( ) ; if ( rowIndexEnd < lastRowNum ) { sheet . shiftRows ( rowIndexEnd + 1 , lastRowNum , - irows ) ; } if ( rowIndexEnd == lastRowNum ) { // reverse order to delete rows. for ( int i = rowIndexEnd ; i >= rowIndexStart ; i -- ) { removeSingleRowInSheet ( sheet , rowIndexStart ) ; } } }
Remove the rows .