https://blog.csdn.net/weixin_45156610/article/details/105433804 cellStyle.setAlignment(HorizontalAlignment.CENTER); cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); cellStyle.setBorderBottom(BorderStyle.THIN); cellStyle.setBottomBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); cellStyle.setBorderLeft(BorderStyle.THIN); cellStyle.setLeftBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); cellStyle.setBorderRight(BorderStyle.THIN); cellStyle.setRightBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); cellStyle.setBorderTop(BorderStyle.THIN); cellStyle.setTopBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());