Re-using your code I simply wrote :
CellStyle styleGreen = cell.getRow().getSheet().getWorkbook().createCellStyle();
styleGreen.setBorderBottom(CellStyle.BORDER_MEDIUM_DASHED);
cell.setCellValue("value"); // testing with some value in the cell
cell.setCellStyle(styleGreen);
And it worked , that's why I suppose the error come from your following code , make sure you do not re-use this style in your code below otherwise you'll end up modifying the previous cells, instead just create a new one.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…