Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ public Boolean mergeCells() {
CellRangeAddress cellRange = new CellRangeAddress(rowStartIdx, rowEndIdx, colStartIdx, colEndIdx);
for (int i = 0; i < pSelectedSheet.getNumMergedRegions(); i++){
CellRangeAddress mergedRegion = pSelectedSheet.getMergedRegion(i);
if (cellRange.intersects(cellRange)){
if (cellRange.intersects(mergedRegion)){
pSelectedSheet.removeMergedRegion(i);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,36 @@ public void testMergeCells() {
excel.close();
}

@Test
public void testMergeMultipleCells() {
ExcelSpreadsheetGXWrapper excel = create("testMergeCells-2");
excel.getCells(1, 1, 2, 5).mergeCells();
excel.getCells(1, 1, 2, 5).setText("merged cells 1");

excel.getCells(5, 1, 2, 5).mergeCells();
excel.getCells(5, 1, 2, 5).setText("merged cells 2");

excel.getCells(8, 1, 2, 5).mergeCells();
excel.getCells(8, 1, 2, 5).setText("merged cells 3");

excel.save();
excel.close();
}

@Test
public void testMergeMultipleCellsIntersect() {
ExcelSpreadsheetGXWrapper excel = create("testMergeCells-3");
excel.getCells(1, 1, 8, 5).mergeCells();
excel.getCells(1, 1, 8, 5).setText("merged cells 1");

excel.getCells(5, 1, 8, 5).mergeCells();
excel.getCells(5, 1, 8, 5).setText("merged cells 2");

excel.save();
excel.close();
}


@Test
public void testMergeNestedCells() {
ExcelSpreadsheetGXWrapper excel = create("testMergeNestedCells");
Expand Down