]> source.dussan.org Git - poi.git/commitdiff
Fix bug #49096 - add clone support to Chart begin and end records, to allow cloning...
authorNick Burch <nick@apache.org>
Wed, 2 Jun 2010 16:01:26 +0000 (16:01 +0000)
committerNick Burch <nick@apache.org>
Wed, 2 Jun 2010 16:01:26 +0000 (16:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@950611 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/hssf/record/chart/BeginRecord.java
src/java/org/apache/poi/hssf/record/chart/EndRecord.java
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
test-data/spreadsheet/49096.xls [new file with mode: 0644]

index 11d5441eb7509435b381ab2d96752b5157c3776e..65790b4f891fe27e77b2189fe23e06ad7d994184 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.7-SNAPSHOT" date="2010-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">49096 - add clone support to Chart begin and end records, to allow cloning of more Chart containing sheets</action>
            <action dev="POI-DEVELOPERS" type="add">List attachment names in the output of OutlookTextExtractor (to get attachment contents, use ExtractorFactory as normal)</action>
            <action dev="POI-DEVELOPERS" type="fix">48872 - allow DateFormatter.formatRawCellContents to handle 1904 as well as 1900 dates</action>
            <action dev="POI-DEVELOPERS" type="fix">48872 - handle MMMMM and elapsed time formatting rules in DataFormatter</action>
index 85e80f024c287c763a19e02126bdd517f360ce5f..2a7baf149729027694616dcf129a10d959810d3d 100644 (file)
@@ -63,4 +63,10 @@ public final class BeginRecord extends StandardRecord {
     {
         return sid;
     }
+    
+    public Object clone() {
+       BeginRecord br = new BeginRecord();
+       // No data so nothing to copy
+       return br;
+    }
 }
index 44a5099e29e03ce5f7f9f8d23b73f44af68c5e0d..4879761192b001b722d27a5b35748c6cad2a37e2 100644 (file)
@@ -64,4 +64,10 @@ public final class EndRecord extends StandardRecord {
     {
         return sid;
     }
+    
+    public Object clone() {
+       EndRecord er = new EndRecord();
+       // No data so nothing to copy
+       return er;
+    }
 }
index 337499415b3d2ee44687f2bf716afe3ec1002803..c6b47848f76f90a81d19cb5c948e3ec9a0f28d43 100644 (file)
@@ -1572,4 +1572,20 @@ public final class TestBugs extends BaseTestBugzillaIssues {
        assertEquals("RT", withoutExt.getString());
        assertTrue((withoutExt.getOptionFlags() & 0x0004) == 0x0000);
     }
+    
+    /**
+     * Problem with cloning a sheet with a chart
+     *  contained in it.
+     */
+    public void test49096() throws Exception {
+       HSSFWorkbook wb = openSample("49096.xls");
+       assertEquals(1, wb.getNumberOfSheets());
+       
+       assertNotNull(wb.getSheetAt(0));
+       wb.cloneSheet(0);
+       assertEquals(2, wb.getNumberOfSheets());
+       
+       wb = writeOutAndReadBack(wb);
+       assertEquals(2, wb.getNumberOfSheets());
+    }
 }
diff --git a/test-data/spreadsheet/49096.xls b/test-data/spreadsheet/49096.xls
new file mode 100644 (file)
index 0000000..4c1e817
Binary files /dev/null and b/test-data/spreadsheet/49096.xls differ