/**
* 给合并单元格加边框
* @throws IOException
*/
public static void border() throws IOException {
CellRangeAddress CellRangeAddress1 = new CellRangeAddress(5,6,3,4);
InputStream input = new FileInputStream(new File("d:/q1.et"));
HSSFWorkbook workbook = new HSSFWorkbook(input);
HSSFSheet sheet = workbook.getSheet("qqq");
sheet.addMergedRegion(CellRangeAddress1);//合并单元格
RegionUtil.setBorderLeft(1, CellRangeAddress1, sheet);
RegionUtil.setBorderBottom(1, CellRangeAddress1, sheet);
RegionUtil.setBorderRight(1, CellRangeAddress1, sheet);
RegionUtil.setBorderTop(1, CellRangeAddress1, sheet);
//给合并的单元格加边框
FileOutputStream output = new FileOutputStream(new File("d:/q1.et"));
workbook.write(output);
if (output != null) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 给指定单元格加边框
* @throws IOException
*/
public static void cell
poi3.17excel加边框
最新推荐文章于 2024-06-26 17:14:23 发布