Bug 60709 - shiftRows removes merged regions if shifting several rows in one call
Summary: shiftRows removes merged regions if shifting several rows in one call
Status: RESOLVED DUPLICATE of bug 60384
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 3.15-FINAL
Hardware: PC Linux
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Blocks: 59740
  Show dependency tree
Reported: 2017-02-08 09:42 UTC by David Le Niniven
Modified: 2017-08-19 15:34 UTC (History)
0 users

File with 2 merged cells (27.44 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2017-02-08 09:42 UTC, David Le Niniven

Note You need to log in before you can comment on or make changes to this bug.
Description David Le Niniven 2017-02-08 09:42:27 UTC
Created attachment 34734 [details]
File with 2 merged cells

The shiftRows method works as expected if we shift only one row at a time, but if we try to shift several rows in a single call, it removes all merged areas that belong to the shifted rows.

For instance, if we have a Xlsx document (cf attachment) with 2 merged cells A3:B3
Assuming lastRowNum = sheet.getLastRowNum();

Executing the following code will removed this merged region : 

sheet.shiftRows(1, lastRowNum+1, -1, true, false);

Whereas the following code will "move" the merged region into A2:B2 as expected

for(int currentRow = 1; currentRow <=lastRowNum+1; currentRow++) {
    sheet.shiftRows(currentRow, currentRow, -1, true, false);
Comment 1 Dominik Stadler 2017-08-19 15:34:27 UTC
This has the same cause as bug #60384 (broken by changes in bug #59740), thus this will be solved when 60384 is fixed (which should happen soon).

*** This bug has been marked as a duplicate of bug 60384 ***