怎么用POI Excel 读取合并单元格的值
展开全部
先判断,再获取
public CellRangeAddress getMergedRegionForCell(Cell c) {
Sheet s = c.getRow().getSheet();
for (CellRangeAddress mergedRegion : s.getMergedRegions()) {
if (mergedRegion.isInRange(c.getRowIndex(), c.getColumnIndex())) {
// This region contains the cell in question
return mergedRegion;
}
}
return null;
}
public CellRangeAddress getMergedRegionForCell(Cell c) {
Sheet s = c.getRow().getSheet();
for (CellRangeAddress mergedRegion : s.getMergedRegions()) {
if (mergedRegion.isInRange(c.getRowIndex(), c.getColumnIndex())) {
// This region contains the cell in question
return mergedRegion;
}
}
return null;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询