Bug 60709

Summary: shiftRows removes merged regions if shifting several rows in one call
Product: POI Reporter: David Le Niniven <david.leniniven>
Component: SS CommonAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P2    
Version: 3.15-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 59740    
Attachments: File with 2 merged cells

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 ***