fixed importing pictures having associated custom tags, see Bugzilla 52687
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1291730 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a70a072562
commit
854e14308f
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.8-beta6" date="2012-??-??">
|
<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="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">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>
|
<action dev="poi-developers" type="fix">52664 - MAPIMessage may not always have name chunks when checking for 7 bit encodings</action>
|
||||||
|
@ -29,6 +29,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType;
|
import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType;
|
||||||
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTPictureNonVisual;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTPictureNonVisual;
|
||||||
|
|
||||||
@ -147,5 +148,11 @@ public class XSLFPictureShape extends XSLFSimpleShape {
|
|||||||
CTBlip blip = ct.getBlipFill().getBlip();
|
CTBlip blip = ct.getBlipFill().getBlip();
|
||||||
blip.setEmbed(relId);
|
blip.setEmbed(relId);
|
||||||
|
|
||||||
|
CTApplicationNonVisualDrawingProps nvPr = ct.getNvPicPr().getNvPr();
|
||||||
|
if(nvPr.isSetCustDataLst()) {
|
||||||
|
// discard any custom tags associated with the picture being copied
|
||||||
|
nvPr.unsetCustDataLst();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ package org.apache.poi.xslf.usermodel;
|
|||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.apache.poi.xslf.XSLFTestDataSamples;
|
import org.apache.poi.xslf.XSLFTestDataSamples;
|
||||||
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -130,4 +131,26 @@ public class TestXSLFPictureShape extends TestCase {
|
|||||||
XSLFSlide slide2 = ppt.createSlide();
|
XSLFSlide slide2 = ppt.createSlide();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testMerge() {
|
||||||
|
XMLSlideShow ppt1 = new XMLSlideShow();
|
||||||
|
byte[] data1 = new byte[100];
|
||||||
|
int idx1 = ppt1.addPicture(data1, XSLFPictureData.PICTURE_TYPE_JPEG);
|
||||||
|
|
||||||
|
XSLFSlide slide1 = ppt1.createSlide();
|
||||||
|
XSLFPictureShape shape1 = slide1.createPicture(idx1);
|
||||||
|
CTPicture ctPic1 = (CTPicture)shape1.getXmlObject();
|
||||||
|
ctPic1.getNvPicPr().getNvPr().addNewCustDataLst().addNewTags().setId("rId99");
|
||||||
|
|
||||||
|
XMLSlideShow ppt2 = new XMLSlideShow();
|
||||||
|
|
||||||
|
XSLFSlide slide2 = ppt2.createSlide().importContent(slide1);
|
||||||
|
XSLFPictureShape shape2 = (XSLFPictureShape)slide2.getShapes()[0];
|
||||||
|
|
||||||
|
assertTrue(Arrays.equals(data1, shape2.getPictureData().getData()));
|
||||||
|
|
||||||
|
CTPicture ctPic2 = (CTPicture)shape2.getXmlObject();
|
||||||
|
assertFalse(ctPic2.getNvPicPr().getNvPr().isSetCustDataLst());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user