Bug 43807 - Problems with "sheet.addMergedRegion()" in Excel 2003 SP3 if colFrom is greater than colTo
Summary: Problems with "sheet.addMergedRegion()" in Excel 2003 SP3 if colFrom is great...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: All other
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-07 07:16 UTC by Ciprian Mihalache
Modified: 2007-11-12 14:24 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ciprian Mihalache 2007-11-07 07:16:56 UTC
In a Java program which exports an xls file, let's say that we have the
following code:
HSSFWorkbook wb = ... //initialization goes here
HSSFSheet sheet = wb.getSheetAt(0);
sheet.addMergedRegion(new Region(1, (short)3, 1, (short)2));
//do other things there and in the end call wb.write(some FileOutputStream file)

If you open the exported file with Excel 2003 SP2 you will not receive any error
or warning message, and everything seems to be ok. 
If you open the exported file with Excel 2003 SP3 you get an error message that
Excel found unreadable content in that file. If you want it to recover the file,
all the exported data (numbers, Strings...) are present in the exported file,
but all cell styles, merged cells, preferred width for columns are lost.
Sincerely, I would prefer an IllegalArgumentException thrown by addMergedRegion
if colFrom is greater than colTo instead of this behavior.
Comment 1 Nick Burch 2007-11-12 14:24:21 UTC
An IllegalArgumentException will now be thrown