private void appendRows ( WritableSheet sheet , FileColumn [ ] columns , List < String [ ] > lines , String sheetName ) throws WriteException { WritableFont headerFont = new WritableFont ( WritableFont . ARIAL , 10 , WritableFont . BOLD ) ; WritableCellFormat headerFormat = new WritableCellFormat ( headerFont ) ; WritableCellFeatures features = new WritableCellFeatures ( ) ; features . removeDataValidation ( ) ; int size = sheet . getRows ( ) ; for ( int i = 0 ; i < lines . size ( ) ; i ++ ) { String [ ] line = lines . get ( i ) ; if ( ( i + size ) > MAX_ROWS ) { logger . severe ( "the worksheet '" + sheetName + "' has exceeded the maximum rows and will be truncated" ) ; break ; } for ( int j = 0 ; j < line . length ; j ++ ) { WritableCell cell = null ; String data = line [ j ] ; if ( data == null ) data = "" ; // Get a cell with the correct formatting if ( columns != null && j < columns . length ) { cell = getCell ( columns [ j ] , j , i + size , data ) ; } else // Try to figure out the type of the column { try { double num = Double . parseDouble ( data ) ; cell = new Number ( j , i + size , num ) ; } catch ( NumberFormatException e ) { cell = new Label ( j , i + size , data ) ; } } if ( cell != null ) { if ( ( i + size ) == 0 && hasHeaders ( ) ) cell . setCellFormat ( headerFormat ) ; else cell . setCellFeatures ( features ) ; sheet . addCell ( cell ) ; } } } }
Appends the given lines to the bottom of the given sheet .