I had posted this last week on the user list and got not a single response, so I'm posting it here as a possible bug. I haven't dug into the source yet, but could do that if necessary.

I'm trying to set the style for an entire row using HSSFRow.setRowStyle(
HSSFCellStyle ), and it's not working.  "Not working" means it simply
doesn't apply the style to any of the cells of the row.  The cell
content is still there unchanged.

This is my full method, and works by setting the style on each cell individually in the loop at the end:

public void writeXlsLine( HSSFSheet sheet, Object[] line, HSSFCellStyle
rowStyle, short rowHeight ) {
     HSSFRow row = sheet.createRow( xlsLine );
     row.setHeightInPoints( rowHeight );
     int colNum = 0;
     for ( Object thisObj : line ) {
         HSSFCell cell = row.createCell( colNum ++ );
         if ( thisObj instanceof String ) {
             cell.setCellValue( (String) thisObj );
         } else if ( thisObj instanceof Double ) {
             cell.setCellValue( (Double) thisObj );
         } else if ( thisObj instanceof Integer ) {
             cell.setCellValue( (Integer) thisObj );
         }
     }


for ( Cell thisCell : row ) {
     thisCell.setCellStyle( rowStyle );
}


But replacing the setCellStyle loop with:

     row.setRowStyle( rowStyle );


Does nothing. If I'm reading the docs correctly, this should work. Or am I missing something?

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to