最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

使用Apache POI合并单元格在Excel中

SEO心得admin36浏览0评论
本文介绍了使用Apache POI合并单元格在Excel中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有合并使用Apache POI库细胞在Excel中任何其他方式?

我试着用以下,但它不工作

//选择地区工作表合并数据 的CellRangeAddress区= CellRangeAddress.valueOf(A+ rowNo +:D             + rowNo); //合并区域 sheet1.addMergedRegion(区);

解决方案

您可以使用 sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo);

例如 sheet.addMergedRegion(新的CellRangeAddress(1,1,4,1)); 将从B2合并E2。请记住它是零的索引。

有关详细信息请参阅 BusyDeveloper指南

Is there any other way to merge cells in Excel using Apache POI library?

I was trying using the following, but its not working

// selecting the region in Worksheet for merging data CellRangeAddress region = CellRangeAddress.valueOf("A" + rowNo + ":D" + rowNo); // merging the region sheet1.addMergedRegion(region);

解决方案

You can use sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo);

example sheet.addMergedRegion(new CellRangeAddress(1,1,4,1)); will merge from B2 to E2. Remember it is zero based indexing.

for detail refer BusyDeveloper's Guide

发布评论

评论列表(0)

  1. 暂无评论