Bug 68230 - A region overlap issue in RowShifter
Summary: A region overlap issue in RowShifter
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 5.3.x-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-27 02:10 UTC by zhonghao
Modified: 2023-11-27 10:29 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhonghao 2023-11-27 02:10:37 UTC
NPOI fixed a region overlap issue:
https://github.com/nissl-lab/npoi/commit/6719bff7e54ce724d07f57de4a7e19ddc36c0a07

The buggy code is still in the trunk of POI. For example, POI fixed the following method: 
public List<CellRangeAddress> ShiftMergedRegions(int startRow, int endRow, int n
{...
  if (removalNeeded(merged, startRow, endRow, n ))
  ...
}
The fixed code is as follows:

public List<CellRangeAddress> ShiftMergedRegions(int startRow, int endRow, int n
{...
  var lastCol=sheet.GetRow(startRow) != null ? sheet.GetRow(startRow).LastCellNum : sheet.GetRow(endRow) != null ? sheet.GetRow(endRow).LastCellNum : 0;
                if (removalNeeded(merged, startRow, endRow, n, lastCol ))
  ...
}

In the trunk, the POI code is as follows:
 public List<CellRangeAddress> shiftMergedRegions(int startRow, int endRow, int n) {...
   if(removalNeeded(merged, startRow, endRow, n)) {
...}

It is quite similar to the buggy NPOI code. There are also other modifications. 
POI can have a similar bug when handling overlapped regions.
Comment 1 PJ Fanning 2023-11-27 10:29:18 UTC
We are not going to just copy NPOI. Please provide real world examples. POI is a volunteer project and it is normally best to provide a patch with a test case yourself.