Package org.apache.poi.xslf.usermodel

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


public class TestXSLFBugs extends POITestCase {

    @SuppressWarnings("deprecation")
    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


   
    /**
     * 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

     * A slideshow can have more than one rID pointing to a given
     *  slide, eg presentation.xml rID1 -> slide1.xml, but slide1.xml
     *  rID2 -> slide3.xml
     */
    public void DISABLEDtest54916() 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

public class TestXSLFBugs extends POITestCase {

    @SuppressWarnings("deprecation")
    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

   
    /**
     * 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

     * A slideshow can have more than one rID pointing to a given
     *  slide, eg presentation.xml rID1 -> slide1.xml, but slide1.xml
     *  rID2 -> slide3.xml
     */
    public void DISABLEDtest54916() 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

     * When the picture is not embedded but inserted only as a "link to file",
     * there is no data available and XSLFPictureShape.getPictureData()
     * gives a NPE, see bug #56812
     */
    public void test56812() 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

     */
    @Override
    protected void buildXHTML(XHTMLContentHandler xhtml) throws SAXException,
            XmlException, IOException {
        XSLFSlideShow slideShow = (XSLFSlideShow) extractor.getDocument();
        XMLSlideShow xmlSlideShow = new XMLSlideShow(slideShow);

        XSLFSlide[] slides = xmlSlideShow.getSlides();
        for (XSLFSlide slide : slides) {
            CTSlide rawSlide = slide._getCTSlide();
            CTSlideIdListEntry slideId = slide._getCTSlideId();

            CTNotesSlide notes = xmlSlideShow._getXSLFSlideShow().getNotes(
                    slideId);
            CTCommentList comments = xmlSlideShow._getXSLFSlideShow()
                    .getSlideComments(slideId);

            xhtml.startElement("div");
            extractShapeContent(rawSlide.getCSld().getSpTree(), xhtml);

View Full Code Here

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

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

TOP

Related Classes of org.apache.poi.xslf.usermodel.XMLSlideShow

Copyright © 2018 www.massapicom. 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.