public static Cell copyCell ( final Sheet destSheet , final Row sourceRow , final Row newRow , final int cellIndex , final boolean checkLock ) { // If the old cell is null jump to next cell Cell sourceCell = sourceRow . getCell ( cellIndex ) ; if ( sourceCell == null ) { return null ; } // If source cell is dest cell refresh it boolean refreshCell = false ; if ( sourceRow . equals ( newRow ) && ( sourceCell . getColumnIndex ( ) == cellIndex ) ) { sourceRow . removeCell ( sourceCell ) ; refreshCell = true ; } Cell newCell = newRow . createCell ( cellIndex ) ; try { if ( ! refreshCell && ( sourceCell . getCellComment ( ) != null ) ) { // If there is a cell comment, copy cloneComment ( sourceCell , newCell ) ; } copyCellSetStyle ( destSheet , sourceCell , newCell ) ; copyCellSetValue ( sourceCell , newCell , checkLock ) ; } catch ( Exception ex ) { LOG . log ( Level . SEVERE , "copy cell set error = " + ex . getLocalizedMessage ( ) , ex ) ; } return newCell ; }
Copy cell .