Package org.apache.poi.xslf.usermodel

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


  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


     * @see org.apache.poi.xslf.extractor.XSLFPowerPointExtractor#getText()
     */
    @Override
    protected void buildXHTML(XHTMLContentHandler xhtml) throws SAXException,
            XmlException, IOException {
        XMLSlideShow slideShow = (XMLSlideShow) extractor.getDocument();
        XSLFSlideShow rawSlideShow = null;
        try {
           rawSlideShow = slideShow._getXSLFSlideShow(); // TODO Avoid this in future
        } catch(Exception e) {
           throw new IOException(e.getMessage()); // Shouldn't happen
        }

        XSLFSlide[] slides = slideShow.getSlides();
        for (XSLFSlide slide : slides) {
           // Find the ID, until we ditch the raw slideshow
           CTSlideIdListEntry slideId = null;
           for(CTSlideIdListEntry id : rawSlideShow.getSlideReferences().getSldIdList()) {
              if(rawSlideShow.getSlidePart(id).getPartName().equals(slide.getPackagePart().getPartName())) {
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

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

            usage();
            return;
        }

        System.out.println("Processing " + file);
        XMLSlideShow ppt = new XMLSlideShow(OPCPackage.open(file));

        Dimension pgsize = ppt.getPageSize();
        int width = (int) (pgsize.width * scale);
        int height = (int) (pgsize.height * scale);

        XSLFSlide[] slide = ppt.getSlides();
        for (int i = 0; i < slide.length; i++) {
            if (slidenum != -1 && slidenum != (i + 1)) continue;

            String title = slide[i].getTitle();
            System.out.println("Rendering slide " + (i + 1) + (title == null ? "" : ": " + title));
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

  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

        if(args.length == 0)  {
            System.out.println("Input file is required");
            return;
        }

        XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(args[0]));

        for(XSLFSlide slide : ppt.getSlides()){
            System.out.println("Title: " + slide.getTitle());

            for(XSLFShape shape : slide.getShapes()){
                if(shape instanceof XSLFTextShape) {
                    XSLFTextShape tsh = (XSLFTextShape)shape;
View Full Code Here

*
* @author Yegor Kozlov
*/
public class Step2 {
    public static void main(String[] args) throws Exception{
        XMLSlideShow ppt = new XMLSlideShow();


        // first see what slide layouts are available by default
        System.out.println("Available slide layouts:");
        for(XSLFSlideMaster master : ppt.getSlideMasters()){
            for(XSLFSlideLayout layout : master.getSlideLayouts()){
                System.out.println(layout.getType());
            }
        }

        // blank slide
        XSLFSlide blankSlide = ppt.createSlide();

        XSLFSlideMaster defaultMaster = ppt.getSlideMasters()[0];

        // title slide
        XSLFSlideLayout titleLayout = defaultMaster.getLayout(SlideLayout.TITLE);
        XSLFSlide slide1 = ppt.createSlide(titleLayout);
        XSLFTextShape title1 = slide1.getPlaceholder(0);
        title1.setText("First Title");

        // title and content
        XSLFSlideLayout titleBodyLayout = defaultMaster.getLayout(SlideLayout.TITLE_AND_CONTENT);
        XSLFSlide slide2 = ppt.createSlide(titleBodyLayout);

        XSLFTextShape title2 = slide2.getPlaceholder(0);
        title2.setText("Second Title");

        XSLFTextShape body2 = slide2.getPlaceholder(1);
        body2.clearText(); // unset any existing text
        body2.addNewTextParagraph().addNewTextRun().setText("First paragraph");
        body2.addNewTextParagraph().addNewTextRun().setText("Second paragraph");
        body2.addNewTextParagraph().addNewTextRun().setText("Third paragraph");



        FileOutputStream out = new FileOutputStream("step2.pptx");
        ppt.write(out);
        out.close();

    }
View Full Code Here

public class TestXSLFBugs extends TestCase {

    @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

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.