Hi, As define in the interface org.apache.poi.ss.usermodel.Cell, the method setStyle can accept a null value (from javadoc) : "If the value is null then the style information is removed causing the cell to used the default workbook style." Or when I look at the implemenation in HSSFCell, I saw that: public void setCellStyle(CellStyle style) { setCellStyle( (HSSFCellStyle)style ); } public void setCellStyle(HSSFCellStyle style) { // Verify it really does belong to our workbook style.verifyBelongsToWorkbook(_book); short styleIndex; if(style.getUserStyleName() != null) { styleIndex = applyUserCellStyle(style); } else { styleIndex = style.getIndex(); } // Change our cell record to use this style _record.setXFIndex(styleIndex); } So a null value is not checked and not taken into account. Thanks, Mayeul
How does XSSF behave in this case? (i.e. is this a bug in the javadoc, or a hssf specific bit of missing functionality)
Hi, Xssf behaves as expected : public void setCellStyle(CellStyle style) { if(style == null) { if(_cell.isSetS()) _cell.unsetS(); } else { .... } }
Thanks for investigating, fixed in r1598258.
I am really amazed by your responsiveness. Glad to help and thanks a lot. Mayeul