==================================================================== */
package org.apache.poi.xslf.usermodel;
+import static org.apache.poi.openxml4j.opc.PackageRelationshipTypes.HDPHOTO_PART;
import static org.apache.poi.openxml4j.opc.PackageRelationshipTypes.IMAGE_PART;
import java.util.HashMap;
"/ppt/media/image#.wdp",
XSLFPictureData::new, XSLFPictureData::new
);
-
+ public static final XSLFRelation HDPHOTO_WDP = new XSLFRelation(
+ PictureType.WDP.contentType,
+ HDPHOTO_PART,
+ "/ppt/media/hdphoto#.wdp",
+ XSLFPictureData::new, XSLFPictureData::new
+ );
public static final XSLFRelation IMAGE_SVG = new XSLFRelation(
PictureType.SVG.contentType,
IMAGE_PART,
* @return ID of the created relationship
*/
String importBlip(String blipId, POIXMLDocumentPart parent) {
- final XSLFPictureData parData = parent.getRelationPartById(blipId).getDocumentPart();
+ final POIXMLDocumentPart docPart = parent.getRelationPartById(blipId).getDocumentPart();
+ XSLFPictureData parData;
+ if (docPart instanceof XSLFPictureData) {
+ parData = (XSLFPictureData)docPart;
+ } else {
+ throw new RuntimeException("cannot import blip " + blipId + " - document part is not XSLFPictureData type");
+ }
final XSLFPictureData pictureData;
if (getPackagePart().getPackage() == parent.getPackagePart().getPackage()) {
// handle ref counter correct, if the parent document is the same as this
import java.awt.Color;
import java.awt.geom.Rectangle2D;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URI;
import java.text.AttributedCharacterIterator;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import org.apache.poi.POIDataSamples;
import org.apache.poi.common.usermodel.HyperlinkType;
import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.sl.usermodel.TextRun;
import org.apache.poi.sl.usermodel.TextShape;
import org.apache.poi.sl.usermodel.VerticalAlignment;
-import org.apache.poi.util.IOUtils;
import org.apache.commons.io.output.NullPrintStream;
import org.apache.poi.xslf.usermodel.*;
import org.apache.poi.xslf.util.DummyGraphics2d;
assertEquals(TextRun.TextCap.ALL, act);
}
}
+
+ @Test
+ public void bug65523() throws IOException {
+ try (XMLSlideShow sourcePresentation = openSampleDocument("bug65523.pptx")) {
+ XMLSlideShow targetPresentation = new XMLSlideShow();
+ XSLFSlide targetPresentationSlide = targetPresentation.createSlide();
+
+ XSLFSlide sourceSlide = sourcePresentation.getSlides().get(0);
+
+ targetPresentationSlide.getSlideMaster().importContent(sourceSlide.getSlideMaster());
+ targetPresentationSlide.getSlideLayout().importContent(sourceSlide.getSlideLayout());
+
+ targetPresentationSlide.importContent(sourceSlide);
+
+ targetPresentation.write(new UnsynchronizedByteArrayOutputStream());
+ }
+ }
}