Menu

Create a presentation dynamically

Help
2008-12-01
2013-04-29
  • Susan Mathew

    Susan Mathew - 2008-12-01

    Hi,

    Can anybody post some sample code to create a powerpoint presentation.

    At least the element hirearchy of a slide ...( like for a docx file document - body - paragraph - run - text. ) . 

    Also is it mandatory to create a master slide, slide layout, theme before creating a slide. 

    I tried like

    Document ppt= DocumentHelper.createDocument();
    Namespace nsPresentationML = new Namespace("p", nameSpace );
               
                   
    Element elSlide = ppt.addElement(new QName("sld",nsPresentationML));
    Element elShape = elSlide.addElement(new QName("sp",nsPresentationML));
    Element elBody = elShape.addElement(new QName("txBody",nsPresentationML));
    Element elParagraph = elBody.addElement(new QName("p",nsPresentationML));
    Element elRun = elParagraph.addElement(new QName("r", nsPresentationML));
    Element elText = elRun.addElement(new QName("t", nsPresentationML));
    elText.setText("Hello Open XML !");

    It's creating a pptx file, but I am not able to open it using a viewer.

    Thanx in advance

    Susan

     
    • Susan Mathew

      Susan Mathew - 2008-12-16

      I have succeeded in creating the master slide, slides, relationships, slideLayouts, themes etc. But the Extended properties part - /docParts/app.xml file is not created.  Can anybody tell me whether we have to create that explicitly t is the role of app.xml file in pptx package.

      Thanx,
      Susan  

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.