Bug 56345 - Reject single-cell merged regions?
Summary: Reject single-cell merged regions?
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-04-03 11:09 UTC by David North
Modified: 2016-02-18 02:07 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description David North 2014-04-03 11:09:25 UTC
Summary: Reject single-cell merged regions?

At the moment, both the XSSF and HSSF implementations of Sheet.addMergedRegion allow merged regions to be added which are single-cell ranges.

Excel 2007 and up complain that the workbook is corrupted in the case of an .xlsx containing single-cell merged regions.

Would it be reasonable to throw an IllegalArgumentException from addMergedRegion if the range is a single cell?

If so, happy to supply a patch & tests.
Comment 1 Dominik Stadler 2015-03-14 14:34:58 UTC
Yes, I think this would be useful. Please provide such a patch/test if possible
Comment 2 Javen O'Neal 2016-02-17 22:48:24 UTC
Added to (S)XSSFSheet.addMergedRegion in r1727776

Remaining: fix HSSFSheet.addMergedRegion [1]

[1] https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?revision=1717903&view=markup#l660
Comment 3 Javen O'Neal 2016-02-18 01:35:05 UTC
Added HSSFSheet implementation and unit test in r1730991.
Comment 4 Javen O'Neal 2016-02-18 02:07:00 UTC
Updated site docs in r1730993