You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by be...@apache.org on 2012/07/24 21:42:29 UTC

svn commit: r1365255 - in /poi/branches/gsoc2012/src/java/org/apache/poi/hssf: model/InternalSheet.java usermodel/HSSFSheet.java

Author: berlog
Date: Tue Jul 24 19:42:28 2012
New Revision: 1365255

URL: http://svn.apache.org/viewvc?rev=1365255&view=rev
Log:
fixed cloning of sheets with charts

Modified:
    poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java
    poi/branches/gsoc2012/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java

Modified: poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java?rev=1365255&r1=1365254&r2=1365255&view=diff
==============================================================================
--- poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java (original)
+++ poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java Tue Jul 24 19:42:28 2012
@@ -351,12 +351,7 @@ public final class InternalSheet {
                 continue;
             }
             if (rb instanceof EscherAggregate){
-                // EscherAggregate is used only as a container for SODRAWING and OBJ record combinations
-                // So, if the container is empty, there is no reason to clone this record
-                // See https://issues.apache.org/bugzilla/show_bug.cgi?id=49529
-//                if (0 == rb.getRecordSize()){
-                    continue;
-//                }
+                rb = new DrawingRecord();
             }
             Record rec = (Record) ((Record) rb).clone();
             clonedRecords.add(rec);

Modified: poi/branches/gsoc2012/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=1365255&r1=1365254&r2=1365255&view=diff
==============================================================================
--- poi/branches/gsoc2012/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/branches/gsoc2012/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Tue Jul 24 19:42:28 2012
@@ -117,10 +117,14 @@ public final class HSSFSheet implements 
     HSSFSheet cloneSheet(HSSFWorkbook workbook) {
         this.getDrawingPatriarch();/**Aggregate drawing records**/
         HSSFSheet sheet = new HSSFSheet(workbook, _sheet.cloneSheet());
+        int pos = sheet._sheet.findFirstRecordLocBySid(DrawingRecord.sid);
+        DrawingRecord dr = (DrawingRecord) sheet._sheet.findFirstRecordBySid(DrawingRecord.sid);
+        if (null != dr){
+            sheet._sheet.getRecords().remove(dr);
+        }
         if (getDrawingPatriarch() != null){
-            int insertPos = sheet._sheet.findFirstRecordLocBySid(WindowTwoRecord.sid);
             HSSFPatriarch patr = HSSFPatriarch.createPatriarch(this.getDrawingPatriarch(), sheet);
-            sheet._sheet.getRecords().add(insertPos, patr._getBoundAggregate());
+            sheet._sheet.getRecords().add(pos, patr._getBoundAggregate());
             sheet._patriarch = patr;
         }
         return sheet;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org