From e367148e09cbbb61e5b48b5deacdf85b5096d1cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alain=20B=C3=A9arez?= Date: Mon, 1 Feb 2021 00:46:25 +0000 Subject: [PATCH] Clone only content of imported chart git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1886087 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xssf/usermodel/XSSFDrawing.java | 3 +-- .../poi/xssf/usermodel/TestXSSFDrawing.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java index bfceacf4ee..fadb24dae8 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java @@ -271,8 +271,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing 0); + + XSSFWorkbook workbook2 = new XSSFWorkbook(); + XSSFSheet sheet2 = workbook2.createSheet(); + XSSFDrawing drawing2 = sheet2.createDrawingPatriarch(); + + drawing.getCharts().forEach(drawing2::importChart); + + assertEquals(drawing.getCharts().size(), drawing2.getCharts().size()); + } private static void checkRewrite(XSSFWorkbook wb) throws IOException { XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb); -- 2.39.5