summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorEvgeniy Berlog <berlog@apache.org>2012-07-24 19:42:28 +0000
committerEvgeniy Berlog <berlog@apache.org>2012-07-24 19:42:28 +0000
commitf1ecf76191727bcefd32557be05600474fa45d68 (patch)
tree837d26d3b87842dfdd6c4ce3942aee3f0a1e3e6e /src/java
parent093d4595528093d9076e544050e4abf42fbcd372 (diff)
downloadpoi-f1ecf76191727bcefd32557be05600474fa45d68.tar.gz
poi-f1ecf76191727bcefd32557be05600474fa45d68.zip
fixed cloning of sheets with charts
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/gsoc2012@1365255 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/hssf/model/InternalSheet.java7
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java8
2 files changed, 7 insertions, 8 deletions
diff --git a/src/java/org/apache/poi/hssf/model/InternalSheet.java b/src/java/org/apache/poi/hssf/model/InternalSheet.java
index ce8e5a9bb3..5e5d601996 100644
--- a/src/java/org/apache/poi/hssf/model/InternalSheet.java
+++ b/src/java/org/apache/poi/hssf/model/InternalSheet.java
@@ -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);
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
index afe4cf99d8..ebbd95cc28 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
@@ -117,10 +117,14 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
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;