HSSFWorkbook 合并单元格后没有边框
时间: 2023-10-16 22:05:16 浏览: 101
在使用HSSFWorkbook进行合并单元格后,出现了没有边框的问题。可以通过以下步骤解决这个问题:
1. 首先,创建一个需要合并单元格的样式。使用`wb.createCellStyle()`创建一个样式对象,然后设置垂直居中和水平居中对齐,使用`boderStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER)`和`boderStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER)`。接着设置边框样式,可以使用`boderStyle.setBorderTop(HSSFBorderFormatting.BORDER_THICK)`来设置顶部边框为粗线。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [POI-HSSFWorkbook合并单元格边框及文字居中问题](https://blog.csdn.net/qq_28108079/article/details/80804944)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [HSSF合并单元格设置边框只有部分边框生效问题](https://blog.csdn.net/weixin_44864748/article/details/122543730)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文