Examples of XMLSlideShow


Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

   
    /**
     * Slide relations with anchors in them
     */
    public void testTIKA705() {
       XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("with_japanese.pptx");
      
       // Should have one slide
       assertEquals(1, ss.getSlides().length);
       XSLFSlide slide = ss.getSlides()[0];
      
       // Check the relations from this
       List<POIXMLDocumentPart> rels = slide.getRelations();
      
       // Should have 6 relations:
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

public class XSLFTestDataSamples {

    public static XMLSlideShow openSampleDocument(String sampleName) {
        InputStream is = POIDataSamples.getSlideShowInstance().openResourceAsStream(sampleName);
        try {
            return new XMLSlideShow(OPCPackage.open(is));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

    public static XMLSlideShow writeOutAndReadBack(XMLSlideShow doc) {
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
            doc.write(baos);
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            return new XMLSlideShow(OPCPackage.open(bais));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

public class TestXSLFBugs {

    @Test
    @SuppressWarnings("deprecation")
    public void bug51187() throws Exception {
       XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("51187.pptx");
      
       assertEquals(1, ss.getSlides().length);
       XSLFSlide slide = ss.getSlides()[0];
      
       // Check the relations on it
       // Note - rId3 is a self reference
       PackagePart slidePart = ss._getXSLFSlideShow().getSlidePart(
             ss._getXSLFSlideShow().getSlideReferences().getSldIdArray(0)
       );
       assertEquals("/ppt/slides/slide1.xml", slidePart.getPartName().toString());
       assertEquals("/ppt/slideLayouts/slideLayout12.xml", slidePart.getRelationship("rId1").getTargetURI().toString());
       assertEquals("/ppt/notesSlides/notesSlide1.xml", slidePart.getRelationship("rId2").getTargetURI().toString());
       assertEquals("/ppt/slides/slide1.xml", slidePart.getRelationship("rId3").getTargetURI().toString());
       assertEquals("/ppt/media/image1.png", slidePart.getRelationship("rId4").getTargetURI().toString());
      
       // Save and re-load
       ss = XSLFTestDataSamples.writeOutAndReadBack(ss);
       assertEquals(1, ss.getSlides().length);
      
       slidePart = ss._getXSLFSlideShow().getSlidePart(
             ss._getXSLFSlideShow().getSlideReferences().getSldIdArray(0)
       );
       assertEquals("/ppt/slides/slide1.xml", slidePart.getPartName().toString());
       assertEquals("/ppt/slideLayouts/slideLayout12.xml", slidePart.getRelationship("rId1").getTargetURI().toString());
       assertEquals("/ppt/notesSlides/notesSlide1.xml", slidePart.getRelationship("rId2").getTargetURI().toString());
       // TODO Fix this
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

    /**
     * Slide relations with anchors in them
     */
    @Test
    public void tika705() {
       XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("with_japanese.pptx");
      
       // Should have one slide
       assertEquals(1, ss.getSlides().length);
       XSLFSlide slide = ss.getSlides()[0];
      
       // Check the relations from this
       List<POIXMLDocumentPart> rels = slide.getRelations();
      
       // Should have 6 relations:
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

     *  rID2 -> slide3.xml
     */
    @Test
    @Ignore
    public void bug54916() throws Exception {
        XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("OverlappingRelations.pptx");
        XSLFSlide slide;
       
        // Should find 4 slides
        assertEquals(4, ss.getSlides().length);
       
        // Check the text, to see we got them in order
        slide = ss.getSlides()[0];
        assertContains("POI cannot read this", getSlideText(slide));
       
        slide = ss.getSlides()[1];
        assertContains("POI can read this", getSlideText(slide));
        assertContains("Has a relationship to another slide", getSlideText(slide));
       
        slide = ss.getSlides()[2];
        assertContains("POI can read this", getSlideText(slide));
       
        slide = ss.getSlides()[3];
        assertContains("POI can read this", getSlideText(slide));
    }
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

     * there is no data available and XSLFPictureShape.getPictureData()
     * gives a NPE, see bug #56812
     */
    @Test
    public void bug56812() throws Exception {
        XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("56812.pptx");
       
        int internalPictures = 0;
        int externalPictures = 0;
        for (XSLFSlide slide : ppt.getSlides()){
            for (XSLFShape shape : slide.getShapes()){
                assertNotNull(shape);
               
                if (shape instanceof XSLFPictureShape) {
                    XSLFPictureShape picture = (XSLFPictureShape)shape;
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

    }

    @Test
    @Ignore("Similar to TestFontRendering it doesn't make sense to compare images because of tiny rendering differences in windows/unix")
    public void bug54542() throws Exception {
        XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("54542_cropped_bitmap.pptx");
       
        Dimension pgsize = ss.getPageSize();
       
        XSLFSlide slide = ss.getSlides()[0];
       
        // render it
        double zoom = 1;
        AffineTransform at = new AffineTransform();
        at.setToScale(zoom, zoom);
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

  public XSLFPowerPointExtractor(XMLSlideShow slideshow) {
    super(slideshow);
    this.slideshow = slideshow;
  }
  public XSLFPowerPointExtractor(XSLFSlideShow slideshow) throws XmlException, IOException {
    this(new XMLSlideShow(slideshow.getPackage()));
  }
View Full Code Here

Examples of org.apache.poi.xslf.usermodel.XMLSlideShow

import org.apache.poi.xslf.usermodel.XSLFSlide;

public class TestXSLFBugs extends TestCase {

    public void test51187() throws Exception {
       XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("51187.pptx");
      
       assertEquals(1, ss.getSlides().length);
       XSLFSlide slide = ss.getSlides()[0];
      
       // Check the relations on it
       // Note - rId3 is a self reference
       PackagePart slidePart = ss._getXSLFSlideShow().getSlidePart(
             ss._getXSLFSlideShow().getSlideReferences().getSldIdArray(0)
       );
       assertEquals("/ppt/slides/slide1.xml", slidePart.getPartName().toString());
       assertEquals("/ppt/slideLayouts/slideLayout12.xml", slidePart.getRelationship("rId1").getTargetURI().toString());
       assertEquals("/ppt/notesSlides/notesSlide1.xml", slidePart.getRelationship("rId2").getTargetURI().toString());
       assertEquals("/ppt/slides/slide1.xml", slidePart.getRelationship("rId3").getTargetURI().toString());
       assertEquals("/ppt/media/image1.png", slidePart.getRelationship("rId4").getTargetURI().toString());
      
       // Save and re-load
       ss = XSLFTestDataSamples.writeOutAndReadBack(ss);
       assertEquals(1, ss.getSlides().length);
      
       slidePart = ss._getXSLFSlideShow().getSlidePart(
             ss._getXSLFSlideShow().getSlideReferences().getSldIdArray(0)
       );
       assertEquals("/ppt/slides/slide1.xml", slidePart.getPartName().toString());
       assertEquals("/ppt/slideLayouts/slideLayout12.xml", slidePart.getRelationship("rId1").getTargetURI().toString());
       assertEquals("/ppt/notesSlides/notesSlide1.xml", slidePart.getRelationship("rId2").getTargetURI().toString());
       // TODO Fix this
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.