Created attachment 27249 [details] extraced xlsxs 'a' & 'b' for HSSFRow there is setRowStyle method, XSSFRow lacks this method. attached you'll find extracted xlsx a & b, the differing files are xl/worksheets/sheet1.xml resp.. in both files there is a '1' in cell A1, which has a certain format (bottom border black thin). in file 'b' the 1st row additionally has the same format set as row format. the differing part is: <row r="1" spans="1:1"> vs. <row r="1" spans="1:1" s="1" customFormat="1"> so i guess the code from XSSFCell should work for XSSFRow (+ customFormat), so it should be something like: public void setCellStyle(CellStyle style) { if(style == null) { if(_row.isSetS()) { // + maybe something like: "|| _row.isSetCustomFormat()" _row.unsetS(); _row.unsetCustomFormat(); } } else { XSSFCellStyle xStyle = (XSSFCellStyle)style; xStyle.verifyBelongsToStylesSource(_stylesSource); long idx = _stylesSource.putStyle(xStyle); _row.setS(idx); _row.setCustomFormat(true); } } the _stylesSource of XSSFRow could be handled exactly like for XSSFCell (as it's only a pointer to row.getSheet().getWorkbook().getStylesSource()).
Thanks for this investigating. I've added support for setting row styles to XSSF and SXSSF in r1144348, along with unit tests. I've also promoted the getter and setter to the Row interface