Getting Exception while merging the cell

Hi Team,

While processing the below line, we are getting the com.aspose.cells.CellsException: Cells in range A19:D19 cannot be merged because cells in range B13:D24 have already been merged.

currentWorksheet.getCells().merge(tempRange.getFirstRow(), tempRange.getFirstColumn(), 1,noOfMergeCells);

We are getting the below value in merge.

currentWorksheet.getCells().merge(18, 0 ,1,4);

We attached the sample excel sheet which we used.


Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells
for Java v8.6.3.2
. We have tested your issue with the following code and it worked fine. I have attached the output excel file generated by it for your reference.


String filePath = “F:\Shak-Data-RW\Downloads\LcKwKaGKVn.xls”;

Workbook wb = new Workbook(filePath);

Worksheet currentWorksheet = wb.getWorksheets().get(0);

currentWorksheet.getCells().merge(18, 0, 1,4); + “.output.xls”);