<changes>
<release version="3.8-beta6" date="2012-??-??">
+ <action dev="poi-developers" type="fix">52687 - fixed merging slides with pictures with associated custom tags</action>
<action dev="poi-developers" type="add"> allow runtime registration of functions in FormulaEvaluator</action>
<action dev="poi-developers" type="fix">52665 - When reading from a ZipFileZipEntrySource that has already been closed, give IllegalArgumentException rather than NPE</action>
<action dev="poi-developers" type="fix">52664 - MAPIMessage may not always have name chunks when checking for 7 bit encodings</action>
import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;\r
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;\r
import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType;\r
+import org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps;\r
import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;\r
import org.openxmlformats.schemas.presentationml.x2006.main.CTPictureNonVisual;\r
\r
CTBlip blip = ct.getBlipFill().getBlip();\r
blip.setEmbed(relId);\r
\r
+ CTApplicationNonVisualDrawingProps nvPr = ct.getNvPicPr().getNvPr();\r
+ if(nvPr.isSetCustDataLst()) {\r
+ // discard any custom tags associated with the picture being copied\r
+ nvPr.unsetCustDataLst();\r
+ }\r
+\r
}\r
}\r
\r
import junit.framework.TestCase;\r
import org.apache.poi.xslf.XSLFTestDataSamples;\r
+import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;\r
\r
import java.io.IOException;\r
import java.util.Arrays;\r
XSLFSlide slide2 = ppt.createSlide();\r
\r
}\r
+\r
+ public void testMerge() {\r
+ XMLSlideShow ppt1 = new XMLSlideShow();\r
+ byte[] data1 = new byte[100];\r
+ int idx1 = ppt1.addPicture(data1, XSLFPictureData.PICTURE_TYPE_JPEG);\r
+\r
+ XSLFSlide slide1 = ppt1.createSlide();\r
+ XSLFPictureShape shape1 = slide1.createPicture(idx1);\r
+ CTPicture ctPic1 = (CTPicture)shape1.getXmlObject();\r
+ ctPic1.getNvPicPr().getNvPr().addNewCustDataLst().addNewTags().setId("rId99");\r
+\r
+ XMLSlideShow ppt2 = new XMLSlideShow();\r
+\r
+ XSLFSlide slide2 = ppt2.createSlide().importContent(slide1);\r
+ XSLFPictureShape shape2 = (XSLFPictureShape)slide2.getShapes()[0];\r
+\r
+ assertTrue(Arrays.equals(data1, shape2.getPictureData().getData()));\r
+\r
+ CTPicture ctPic2 = (CTPicture)shape2.getXmlObject();\r
+ assertFalse(ctPic2.getNvPicPr().getNvPr().isSetCustDataLst());\r
+\r
+ }\r
}
\ No newline at end of file