Package org.apache.poi.hslf.usermodel
Class HSLFSlideShow
java.lang.Object
org.apache.poi.hslf.usermodel.HSLFSlideShow
- All Implemented Interfaces:
Closeable
,AutoCloseable
,SlideShow<HSLFShape,
HSLFTextParagraph>
public final class HSLFSlideShow
extends Object
implements SlideShow<HSLFShape,HSLFTextParagraph>, Closeable
This class is a friendly wrapper on top of the more scary HSLFSlideShow.
TODO: - figure out how to match notes to their correct sheet (will involve
understanding DocSlideList and DocNotesList) - handle Slide creation cleaner
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new, empty, Powerpoint document.HSLFSlideShow
(InputStream inputStream) Constructs a Powerpoint document from an input stream.HSLFSlideShow
(HSLFSlideShowImpl hslfSlideShow) Constructs a Powerpoint document from the underlying HSLFSlideShow object.HSLFSlideShow
(DirectoryNode root) Constructs a Powerpoint document from an DirectoryNode.HSLFSlideShow
(POIFSFileSystem npoifs) Constructs a Powerpoint document from an POIFSFileSystem. -
Method Summary
Modifier and TypeMethodDescriptionint
addControl
(String name, String progId) Add a control in this presentationint
addEmbed
(POIFSFileSystem poiData) Add a embedded object to this presentationAdd a font in this presentationint
Add a movie in this presentationaddPicture
(byte[] data, PictureData.PictureType format) Adds a picture to the presentation.addPicture
(File pict, PictureData.PictureType format) Adds a picture to the presentation.addPicture
(InputStream is, PictureData.PictureType format) Adds a picture to the presentation.void
close()
Create a blankSlide
.findPictureData
(byte[] pictureData) check if a picture with this picture data already exists in this presentationHelper method for usermodel and model: Get the document recordReturns the data of all the embedded OLE object in the SlideShowgetFont
(int idx) Get a font by indexRecord[]
Returns an array of the most recent version of all the interesting recordsgetNotes()
Returns an array of all the normal Notes found in the slideshowReturn Header / Footer settings for notesint
get the number of fonts in the presentationReturns the current page sizeReturns all Pictures of this slideshow.Return Header / Footer settings for slidesReturns an array of all the normal Slide Masters found in the slideshowReturns an array of all the normal Slides found in the slideshowReturns the data of all the embedded sounds in the SlideShowReturns an array of all the normal Title Masters found in the slideshowremoveSlide
(int index) Removes the slide at the given index (0-based).void
reorderSlide
(int oldSlideNumber, int newSlideNumber) Re-orders a slide, to a new position.void
setPageSize
(Dimension pgsize) Change the current page sizevoid
write
(OutputStream out) Writes out the slideshow file the is represented by an instance of this class
-
Field Details
-
POWERPOINT_DOCUMENT
Powerpoint document entry/stream name- See Also:
-
PP95_DOCUMENT
- See Also:
-
-
Constructor Details
-
HSLFSlideShow
Constructs a Powerpoint document from the underlying HSLFSlideShow object. Finds the model stuff from this- Parameters:
hslfSlideShow
- the HSLFSlideShow to base on
-
HSLFSlideShow
public HSLFSlideShow()Constructs a new, empty, Powerpoint document. -
HSLFSlideShow
Constructs a Powerpoint document from an input stream.- Throws:
IOException
-
HSLFSlideShow
Constructs a Powerpoint document from an POIFSFileSystem.- Throws:
IOException
-
HSLFSlideShow
Constructs a Powerpoint document from an DirectoryNode.- Throws:
IOException
-
-
Method Details
-
write
Description copied from interface:SlideShow
Writes out the slideshow file the is represented by an instance of this class- Specified by:
write
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Parameters:
out
- The OutputStream to write to.- Throws:
IOException
- If there is an unexpected IOException from the passed in OutputStream
-
getMostRecentCoreRecords
public Record[] getMostRecentCoreRecords()Returns an array of the most recent version of all the interesting records -
getSlides
Returns an array of all the normal Slides found in the slideshow- Specified by:
getSlides
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph>
-
getNotes
Returns an array of all the normal Notes found in the slideshow -
getSlideMasters
Returns an array of all the normal Slide Masters found in the slideshow- Specified by:
getSlideMasters
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph>
-
getTitleMasters
Returns an array of all the normal Title Masters found in the slideshow -
getPictureData
Description copied from interface:SlideShow
Returns all Pictures of this slideshow. The returnedList
is unmodifiable.- Specified by:
getPictureData
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Returns:
- a
List
ofPictureData
.
-
getEmbeddedObjects
Returns the data of all the embedded OLE object in the SlideShow -
getSoundData
Returns the data of all the embedded sounds in the SlideShow -
getPageSize
Description copied from interface:SlideShow
Returns the current page size- Specified by:
getPageSize
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Returns:
- the page size
-
setPageSize
Description copied from interface:SlideShow
Change the current page size- Specified by:
setPageSize
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Parameters:
pgsize
- page size (in points)
-
getDocumentRecord
Helper method for usermodel and model: Get the document record -
reorderSlide
public void reorderSlide(int oldSlideNumber, int newSlideNumber) Re-orders a slide, to a new position.- Parameters:
oldSlideNumber
- The old slide number (1 based)newSlideNumber
- The new slide number (1 based)
-
removeSlide
Removes the slide at the given index (0-based).Shifts any subsequent slides to the left (subtracts one from their slide numbers).
- Parameters:
index
- the index of the slide to remove (0-based)- Returns:
- the slide that was removed from the slide show.
-
createSlide
Create a blankSlide
.- Specified by:
createSlide
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Returns:
- the created
Slide
-
addPicture
Description copied from interface:SlideShow
Adds a picture to the presentation.- Specified by:
addPicture
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Parameters:
data
- The bytes of the pictureformat
- The format of the picture.- Returns:
- the picture data reference.
- Throws:
IOException
-
addPicture
public HSLFPictureData addPicture(InputStream is, PictureData.PictureType format) throws IOException Adds a picture to the presentation.- Specified by:
addPicture
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Parameters:
is
- The stream to read the image fromformat
- The format of the picture.- Returns:
- the picture data.
- Throws:
IOException
- Since:
- 3.15 beta 2
-
addPicture
Adds a picture to the presentation.- Specified by:
addPicture
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Parameters:
pict
- the file containing the image to addformat
- The format of the picture.- Returns:
- the picture data.
- Throws:
IOException
- Since:
- 3.15 beta 2
-
findPictureData
check if a picture with this picture data already exists in this presentation- Specified by:
findPictureData
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - 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 3
-
addFont
Add a font in this presentation- Parameters:
fontInfo
- the font to add- Returns:
- the registered HSLFFontInfo - the font info object is unique based on the typeface
-
getFont
Get a font by index- Parameters:
idx
- 0-based index of the font- Returns:
- of an instance of
PPFont
ornull
if not found
-
getNumberOfFonts
public int getNumberOfFonts()get the number of fonts in the presentation- Returns:
- number of fonts
-
addMovie
Add a movie in this presentation- Parameters:
path
- the path or url to the movie- Returns:
- 0-based index of the movie
-
addControl
Add a control in this presentation- Parameters:
name
- name of the control, e.g. "Shockwave Flash Object"progId
- OLE Programmatic Identifier, e.g. "ShockwaveFlash.ShockwaveFlash.9"- Returns:
- 0-based index of the control
-
addEmbed
Add a embedded object to this presentation- Returns:
- 0-based index of the embedded object
-
getMetadataTextExtractor
- Specified by:
getMetadataTextExtractor
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Returns:
- an extractor for the slideshow metadata
-
createMasterSheet
- Specified by:
createMasterSheet
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph>
-
getResources
- Specified by:
getResources
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph>
-
getSlideShowImpl
- Returns:
- the handler class which holds the hslf records
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getPersistDocument
- Specified by:
getPersistDocument
in interfaceSlideShow<HSLFShape,
HSLFTextParagraph> - Returns:
- the instance which handles the persisting of the slideshow,
which is either a subclass of
POIDocument
orPOIXMLDocument
-