Package org.apache.poi.xslf.usermodel

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


      POIXMLTextExtractor extractor = (POIXMLTextExtractor) ExtractorFactory.createExtractor(bis);
      POIXMLDocument document = extractor.getDocument();

      if (document instanceof XSLFSlideShow) {
        XSLFSlideShow slideShow = (XSLFSlideShow) document;
        XMLSlideShow xmlSlideShow = new XMLSlideShow(slideShow);
        extractContent(buffy, xmlSlideShow);
      }

      return buffy.toString();
    } catch (Exception e) {
View Full Code Here


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

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

    public static XMLSlideShow writeOutAndReadBack(XMLSlideShow doc) {
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
            doc._getXSLFSlideShow().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

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

import java.util.List;

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

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

  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

    /**
     * @see org.apache.poi.xslf.extractor.XSLFPowerPointExtractor#getText()
     */
    protected void buildXHTML(XHTMLContentHandler xhtml) throws SAXException, IOException {
        XMLSlideShow slideShow = (XMLSlideShow) extractor.getDocument();

        XSLFSlide[] slides = slideShow.getSlides();
        for (XSLFSlide slide : slides) {
            String slideDesc;
            if (slide.getPackagePart() != null && slide.getPackagePart().getPartName() != null) {
              slideDesc = getJustFileName(slide.getPackagePart().getPartName().toString());
              slideDesc += "_";
View Full Code Here

     *  and slide drawings which have the images
     */
    @Override
    protected List<PackagePart> getMainDocumentParts() throws TikaException {
       List<PackagePart> parts = new ArrayList<PackagePart>();
       XMLSlideShow slideShow = (XMLSlideShow) extractor.getDocument();
       XSLFSlideShow document = null;
       try {
          document = slideShow._getXSLFSlideShow(); // TODO Avoid this in future
       } catch(Exception e) {
          throw new TikaException(e.getMessage()); // Shouldn't happen
       }
      
       for (CTSlideIdListEntry ctSlide : document.getSlideReferences().getSldIdList()) {
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.