添加边框在POI生成Excel文件中单元格 [英] Add borders to cells in POI generated Excel File

查看:190
本文介绍了添加边框在POI生成Excel文件中单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用POI生成Excel文件。我需要边框添加到特定的细胞在工作表中。

I am using POI to generate an Excel File. I need to add borders to specific cells in the worksheet.

我怎样才能做到这一点?

How can I accomplish this?

推荐答案

在电池使用的样式设置边框将做到这一点。例如:

Setting up borders in the style used in the cells will accomplish this. Example:

style.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
style.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
style.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);

这篇关于添加边框在POI生成Excel文件中单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆