企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```java //创建样式对象 CellStyle cellStyle = workbook.createCellStyle(); //设置单元格边框上/右/下/左的边框样式 cellStyle.setBorderTop(BorderStyle.MEDIUM_DASHED); cellStyle.setBorderRight(BorderStyle.MEDIUM_DASHED); cellStyle.setBorderBottom(BorderStyle.MEDIUM_DASHED); cellStyle.setBorderLeft(BorderStyle.MEDIUM_DASHED); SXSSFRow row = sheet.createRow(i + 1); SXSSFCell cell = row.createCell(0); //将样式用到单元格中 cell.setCellStyle(cellStyle); ``` 边框效果如下: ![](https://img.kancloud.cn/a8/93/a893b4c355b33c5fdc7cb9ceea45c589_1637x267.png)