Free Support Forum -

Unmerge Cells in Java

Hello Aspose Team,

How does one Unmerge cell using Aspose Cell for Java. i have downloaded the latest version of Aspose for Java.


We will provide unmerge method for java version soon.

Thank you.

Thanks Amjad for responding.

Any ETA when I can expect that?.It would help in scheduling/estimating my work



In the old version, you can get the list of merged areas to merge and unmerge the cell area.(See Cells.getMergedCells method )

And we have added umerged method(Cells.unMerge(int startRow, int startColumn, int endRow, int endColumn) in the attached fix. Please try it.

Thanks Warren,

The fix seems to work. But works if I provide a range of merged cells. But my problem is I won't know exactly what cell ranges are merged. I would like to specify all rows & columns & the unmerge should unmerge all the merged cells in the work sheet.

For eg :-


Any sugestions?Example?


Well, I think you may use Cells.getMergedCells to get the ArrayList CellArea(s) and then utilize the methods of CellArea class to unmerge the ranges for your requirement.

Thank you.

Thanks Amjad,

I figured that out. For the benefit of other people below was the code to do that

ArrayList al = new ArrayList();


CellArea ca;

int frow,fcol,erow,ecol;

List copyList = new ArrayList(al);//Imp as unmerge cell changes the al size

//UnMerge all the cells

for (int j = 0;j< copyList.size();j++)


ca = new CellArea();

ca = (CellArea)copyList.get(j);

frow = ca.getStartRow();

fcol = ca.getStartColumn();

erow = ca.getEndRow();

ecol = ca.getEndColumn();




ArrayList al = dataSheet.getCells().getMergedCells();

If you want to clear all merged area, please call al.clear();

If you want to remove a merged area, prelease call al.remove(i) .

Thanks Warren,

That Works!!!