protected Set < CellElement > getIgnoredCellElements ( Band band ) { Set < CellElement > result = new HashSet < CellElement > ( ) ; int rows = band . getRowCount ( ) ; int cols = band . getColumnCount ( ) ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) { BandElement element = band . getElementAt ( i , j ) ; if ( element == null ) { continue ; } int rowSpan = element . getRowSpan ( ) ; int colSpan = element . getColSpan ( ) ; if ( ( rowSpan > 1 ) && ( colSpan > 1 ) ) { for ( int k = 0 ; k < rowSpan ; k ++ ) { for ( int m = 0 ; m < colSpan ; m ++ ) { if ( ( k != 0 ) || ( m != 0 ) ) { result . add ( new CellElement ( i + k , j + m ) ) ; } } } } else if ( rowSpan > 1 ) { for ( int k = 1 ; k < rowSpan ; k ++ ) { result . add ( new CellElement ( i + k , j ) ) ; } } else if ( colSpan > 1 ) { for ( int k = 1 ; k < colSpan ; k ++ ) { result . add ( new CellElement ( i , j + k ) ) ; } } } } return result ; }
and the other merged cells are null band elements .