如何使用Apache POI Java库取消合并电子表格中的单元格 [英] How to unmerge cells in a spreadsheet using apache POI java library

查看:1215
本文介绍了如何使用Apache POI Java库取消合并电子表格中的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo);在工作表中添加合并的单元格,但是我已经有了一个包含合并单元格的工作表,我想取消合并这些单元格.

We can use sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo); for adding merged cells in the sheet But I already have a sheet with merged cells in it and I want to unmerge these cells.

是否可以使用Apache POI取消工作表单元格的合并而无需创建新工作表?

Is there any way to unmerge cells of a sheet without creating new sheet using Apache POI ?

推荐答案

为评论添加评论...

Promoting a comment to an answer...

您想要的方法是 Sheet.removeMergedRegion(int)

获取区域索引,该索引是在添加区域时获得的.否则,您可以使用 getNumMergedRegions( ) getMergedRegion (int)遍历区域以找到要删除的区域的索引

That takes the index of the region, which you got when you added it. Otherwise, you can use getNumMergedRegions() and getMergedRegion(int) to iterate over the regions to find the index of the one you want to remove

这篇关于如何使用Apache POI Java库取消合并电子表格中的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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