https://issues.apache.org/bugzilla/show_bug.cgi?id=46009
Summary: Cloning sheet with merged region causes
ArrayStoreException when saving.
Product: POI
Version: 3.5-dev
Platform: PC
OS/Version: Mac OS X 10.4
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
Created an attachment (id=22730)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=22730)
A test case that clones sheets with and without a merged region.
If you clone a sheet that has a merged region, you get an exception when you
attempt to write the workbook:
$ run
There is 1 sheet.
There are 2 sheets.
Worked for: noMergedRegion
There is 1 sheet.
There are 2 sheets.
Failed for: hasMergedRegion
java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at java.util.ArrayList.toArray(ArrayList.java:304)
at
org.apache.poi.hssf.record.aggregates.MergedCellsTable.visitContainedRecords(MergedCellsTable.java:85)
at
org.apache.poi.hssf.model.Sheet.visitContainedRecords(Sheet.java:577)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:1319)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1229)
at TestCase.test(TestCase.java:30)
at TestCase.main(TestCase.java:10)
Code to reproduced the above is attached.
Workaround: Remove all the merged regions from the cloned sheet. Then loop over
the merged regions in the original sheet and add each one found to the cloned
sheet. The resulting workbook saves without a problem.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]