org.apache.poi.xslf.usermodel
Class XMLSlideShow

java.lang.Object
  extended by org.apache.poi.POIXMLDocumentPart
      extended by org.apache.poi.POIXMLDocument
          extended by org.apache.poi.xslf.usermodel.XMLSlideShow
All Implemented Interfaces:
java.io.Closeable, SlideShow<XSLFShape,XSLFTextParagraph>

@Beta
public class XMLSlideShow
extends POIXMLDocument
implements SlideShow<XSLFShape,XSLFTextParagraph>

High level representation of a ooxml slideshow. This is the first object most users will construct whether they are reading or writing a slideshow. It is also the top level object for creating new slides/etc.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.poi.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
 
Field Summary
 
Fields inherited from class org.apache.poi.POIXMLDocument
DOCUMENT_CREATOR, OLE_OBJECT_REL_TYPE, PACK_OBJECT_REL_TYPE
 
Constructor Summary
XMLSlideShow()
           
XMLSlideShow(java.io.InputStream is)
           
XMLSlideShow(OPCPackage pkg)
           
 
Method Summary
 XSLFPictureData addPicture(byte[] pictureData, PictureData.PictureType format)
          Adds a picture to the workbook.
 XSLFPictureData addPicture(java.io.File pict, PictureData.PictureType format)
          Adds a picture to the presentation.
 XSLFPictureData addPicture(java.io.InputStream is, PictureData.PictureType format)
          Adds a picture to the slideshow.
protected  void commit()
          Save the content in the underlying package part.
 MasterSheet<XSLFShape,XSLFTextParagraph> createMasterSheet()
           
 void createNotesMaster()
          Create a notes master.
 XSLFSlide createSlide()
          Create a blank slide using the default (first) master.
 XSLFSlide createSlide(XSLFSlideLayout layout)
          Create a slide and initialize it from the specified layout.
 XSLFSlideLayout findLayout(java.lang.String name)
          Scan the master slides for the first slide layout with the given name.
 XSLFPictureData findPictureData(byte[] pictureData)
          check if a picture with this picture data already exists in this presentation
 java.util.List<PackagePart> getAllEmbedds()
          Get the document's embedded files.
 XSLFCommentAuthors getCommentAuthors()
          Returns the list of comment authors, if there is one.
 org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation getCTPresentation()
           
 XSLFNotesMaster getNotesMaster()
          Return the Notes Master, if there is one.
 XSLFNotes getNotesSlide(XSLFSlide slide)
          Return notes slide for the specified slide or create new if it does not exist yet.
 java.awt.Dimension getPageSize()
           
 java.util.List<XSLFPictureData> getPictureData()
           
 Resources getResources()
           
 java.util.List<XSLFSlideMaster> getSlideMasters()
           
 java.util.List<XSLFSlide> getSlides()
          Return all the slides in the slideshow
 XSLFTableStyles getTableStyles()
           
protected  void onDocumentRead()
          Fired when a package part is read
 XSLFSlide removeSlide(int index)
           
 void setPageSize(java.awt.Dimension pgSize)
           
 void setSlideOrder(XSLFSlide slide, int newIndex)
           
 
Methods inherited from class org.apache.poi.POIXMLDocument
close, getCorePart, getPackage, getProperties, getRelatedByType, load, openPackage, write
 
Methods inherited from class org.apache.poi.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationParts, getRelations, getTargetPart, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.poi.sl.usermodel.SlideShow
write
 
Methods inherited from interface java.io.Closeable
close
 

Constructor Detail

XMLSlideShow

public XMLSlideShow()

XMLSlideShow

public XMLSlideShow(OPCPackage pkg)

XMLSlideShow

public XMLSlideShow(java.io.InputStream is)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

onDocumentRead

protected void onDocumentRead()
                       throws java.io.IOException
Description copied from class: POIXMLDocumentPart
Fired when a package part is read

Overrides:
onDocumentRead in class POIXMLDocumentPart
Throws:
java.io.IOException - a subclass may throw an IOException when a document is read

commit

protected void commit()
               throws java.io.IOException
Description copied from class: POIXMLDocumentPart
Save the content in the underlying package part. Default implementation is empty meaning that the package part is left unmodified. Sub-classes should override and add logic to marshal the "model" into Ooxml4J. For example, the code saving a generic XML entry may look as follows:
 protected void commit() throws IOException {
   PackagePart part = getPackagePart();
   OutputStream out = part.getOutputStream();
   XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
   bean.save(out, DEFAULT_XML_OPTIONS);
   out.close();
 }
 

Overrides:
commit in class POIXMLDocumentPart
Throws:
java.io.IOException - a subclass may throw an IOException if the changes can't be committed

getAllEmbedds

public java.util.List<PackagePart> getAllEmbedds()
                                          throws OpenXML4JException
Get the document's embedded files.

Specified by:
getAllEmbedds in class POIXMLDocument
Returns:
the document's embedded files
Throws:
OpenXML4JException - if the embedded parts can't be determined

getPictureData

public java.util.List<XSLFPictureData> getPictureData()
Specified by:
getPictureData in interface SlideShow<XSLFShape,XSLFTextParagraph>

createSlide

public XSLFSlide createSlide(XSLFSlideLayout layout)
Create a slide and initialize it from the specified layout.

Parameters:
layout - The layout to use for the new slide.
Returns:
created slide

createSlide

public XSLFSlide createSlide()
Create a blank slide using the default (first) master.

Specified by:
createSlide in interface SlideShow<XSLFShape,XSLFTextParagraph>

getNotesSlide

public XSLFNotes getNotesSlide(XSLFSlide slide)
Return notes slide for the specified slide or create new if it does not exist yet.


createNotesMaster

public void createNotesMaster()
Create a notes master.


getNotesMaster

public XSLFNotesMaster getNotesMaster()
Return the Notes Master, if there is one. (May not be present if no notes exist)


getSlideMasters

public java.util.List<XSLFSlideMaster> getSlideMasters()
Specified by:
getSlideMasters in interface SlideShow<XSLFShape,XSLFTextParagraph>

getSlides

public java.util.List<XSLFSlide> getSlides()
Return all the slides in the slideshow

Specified by:
getSlides in interface SlideShow<XSLFShape,XSLFTextParagraph>

getCommentAuthors

public XSLFCommentAuthors getCommentAuthors()
Returns the list of comment authors, if there is one. Will only be present if at least one slide has comments on it.


setSlideOrder

public void setSlideOrder(XSLFSlide slide,
                          int newIndex)
Parameters:
newIndex - 0-based index of the slide

removeSlide

public XSLFSlide removeSlide(int index)

getPageSize

public java.awt.Dimension getPageSize()
Specified by:
getPageSize in interface SlideShow<XSLFShape,XSLFTextParagraph>

setPageSize

public void setPageSize(java.awt.Dimension pgSize)
Specified by:
setPageSize in interface SlideShow<XSLFShape,XSLFTextParagraph>

getCTPresentation

@Internal
public org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation getCTPresentation()

addPicture

public XSLFPictureData addPicture(byte[] pictureData,
                                  PictureData.PictureType format)
Adds a picture to the workbook.

Specified by:
addPicture in interface SlideShow<XSLFShape,XSLFTextParagraph>
Parameters:
pictureData - The bytes of the picture
format - The format of the picture.
Returns:
the picture data

addPicture

public XSLFPictureData addPicture(java.io.InputStream is,
                                  PictureData.PictureType format)
                           throws java.io.IOException
Adds a picture to the slideshow.

Specified by:
addPicture in interface SlideShow<XSLFShape,XSLFTextParagraph>
Parameters:
is - The stream to read image from
format - The format of the picture
Returns:
the picture data
Throws:
java.io.IOException
Since:
3.15 beta 2

addPicture

public XSLFPictureData addPicture(java.io.File pict,
                                  PictureData.PictureType format)
                           throws java.io.IOException
Adds a picture to the presentation.

Specified by:
addPicture in interface SlideShow<XSLFShape,XSLFTextParagraph>
Parameters:
pict - The file containing the image to add
format - The format of the picture.
Returns:
the picture data
Throws:
java.io.IOException
Since:
3.15 beta 2

findPictureData

public XSLFPictureData findPictureData(byte[] pictureData)
check if a picture with this picture data already exists in this presentation

Specified by:
findPictureData in interface SlideShow<XSLFShape,XSLFTextParagraph>
Parameters:
pictureData - The picture data to find in the SlideShow
Returns:
null if picture data is not found in this slideshow
Since:
3.15 beta 2

findLayout

public XSLFSlideLayout findLayout(java.lang.String name)
Scan the master slides for the first slide layout with the given name.

Parameters:
name - The layout name (case-insensitive). Cannot be null.
Returns:
the first layout found or null on failure

getTableStyles

public XSLFTableStyles getTableStyles()

createMasterSheet

public MasterSheet<XSLFShape,XSLFTextParagraph> createMasterSheet()
                                                           throws java.io.IOException
Specified by:
createMasterSheet in interface SlideShow<XSLFShape,XSLFTextParagraph>
Throws:
java.io.IOException

getResources

public Resources getResources()
Specified by:
getResources in interface SlideShow<XSLFShape,XSLFTextParagraph>