Bug 63371 - addMergedRegion does not update CTMergeCells.getCount
Summary: addMergedRegion does not update CTMergeCells.getCount
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.0.x-dev
Hardware: PC All
: P2 minor (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-21 19:44 UTC by David Gauntt
Modified: 2019-04-23 20:28 UTC (History)
0 users



Attachments
Patch to have addMergedRegion update CTMergeCells.getCount() (1.95 KB, patch)
2019-04-21 19:47 UTC, David Gauntt
Details | Diff
Test case to illustrate bug 63371 (1.47 KB, text/plain)
2019-04-21 19:54 UTC, David Gauntt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Gauntt 2019-04-21 19:44:25 UTC
The return value of the following function is the same before and after calling XSSFSheet.addMergedRegion(CellRangeAddress):

XSSFSheet.getCTWorksheet().getMergeCells().getCount()

The return value of the following functions increments properly after calling addMergedRegion:

XSSFSheet.getMergedRegions.size()
XSSFSheet.getNumMergedRegions()
XSSFSheet.getCTWorksheet().getMergeCells().getMergeCellList().size().

I will be uploading a test case and a patch soon.
Comment 1 David Gauntt 2019-04-21 19:47:52 UTC
Created attachment 36540 [details]
Patch to have addMergedRegion update CTMergeCells.getCount()

This also includes a fix to bug 63073
Comment 2 David Gauntt 2019-04-21 19:54:46 UTC
Created attachment 36541 [details]
Test case to illustrate bug 63371

Before applying the patch, this code writes the following to System.out:


testMergeRegions(After adding first region)
ranges.size=1
numMergedRegions=1
ctMergeCellCount=0
ctMergeCellListSize=1

After applying the patch, the result is

testMergeRegions(After adding first region)
ranges.size=1
numMergedRegions=1
ctMergeCellCount=1
ctMergeCellListSize=1
Comment 3 Dominik Stadler 2019-04-23 20:28:20 UTC
Fixed on trunk via r1858022, thanks for the patch!