@Beta public class XMLSlideShow extends POIXMLDocument implements SlideShow<XSLFShape,XSLFTextParagraph>
POIXMLDocumentPart.RelationPart
DOCUMENT_CREATOR, OLE_OBJECT_REL_TYPE, PACK_OBJECT_REL_TYPE
Constructor and Description |
---|
XMLSlideShow() |
XMLSlideShow(java.io.InputStream is) |
XMLSlideShow(OPCPackage pkg) |
Modifier and Type | Method and Description |
---|---|
XSLFFontInfo |
addFont(java.io.InputStream fontStream)
Add an EOT font to the slideshow.
|
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.
|
XSLFChart |
createChart()
This method is used to create template for chart XML.
|
XSLFChart |
createChart(XSLFSlide slide)
Create a blank chart on the given slide.
|
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> |
getAllEmbeddedParts()
Get the document's embedded files.
|
java.util.List<XSLFChart> |
getCharts()
Return all the charts in the slideshow
|
XSLFCommentAuthors |
getCommentAuthors()
Returns the list of comment authors, if there is one.
|
org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation |
getCTPresentation() |
java.util.List<XSLFFontInfo> |
getFonts() |
static int |
getMaxRecordLength() |
POIXMLPropertiesTextExtractor |
getMetadataTextExtractor() |
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()
Returns the current page size
|
java.lang.Object |
getPersistDocument() |
java.util.List<XSLFPictureData> |
getPictureData()
Returns all Pictures of this slideshow.
|
java.util.List<XSLFSlideMaster> |
getSlideMasters()
Returns all slide masters.
|
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) |
static void |
setMaxRecordLength(int length) |
void |
setPageSize(java.awt.Dimension pgSize)
Change the current page size
|
void |
setSlideOrder(XSLFSlide slide,
int newIndex) |
close, getCorePart, getPackage, getProperties, getRelatedByType, load, openPackage, write
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
public XMLSlideShow()
public XMLSlideShow(OPCPackage pkg)
pkg
- OPC packagePOIXMLException
- a RuntimeException that can be caused by invalid OOXML datajava.lang.RuntimeException
- a number of other runtime exceptions can be thrown, especially if there are problems with the
input formatpublic XMLSlideShow(java.io.InputStream is) throws java.io.IOException
is
- InputStreamjava.io.IOException
- If reading data from the stream failsPOIXMLException
- a RuntimeException that can be caused by invalid OOXML datajava.lang.RuntimeException
- a number of other runtime exceptions can be thrown, especially if there are problems with the
input formatpublic static void setMaxRecordLength(int length)
length
- the max record length allowed for XMLSlideShowpublic static int getMaxRecordLength()
protected void onDocumentRead() throws java.io.IOException
POIXMLDocumentPart
onDocumentRead
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException when a document is readprotected void commit() throws java.io.IOException
POIXMLDocumentPart
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(); try (OutputStream out = part.getOutputStream()) { XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); } }
commit
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committedpublic java.util.List<PackagePart> getAllEmbeddedParts()
getAllEmbeddedParts
in class POIXMLDocument
public java.util.List<XSLFPictureData> getPictureData()
SlideShow
List
is unmodifiable.getPictureData
in interface SlideShow<XSLFShape,XSLFTextParagraph>
List
of PictureData
.public XSLFSlide createSlide(XSLFSlideLayout layout)
layout
- The layout to use for the new slide.public XSLFSlide createSlide()
createSlide
in interface SlideShow<XSLFShape,XSLFTextParagraph>
public XSLFChart createChart()
public XSLFNotes getNotesSlide(XSLFSlide slide)
public void createNotesMaster()
public XSLFNotesMaster getNotesMaster()
public java.util.List<XSLFSlideMaster> getSlideMasters()
SlideShow
getSlideMasters
in interface SlideShow<XSLFShape,XSLFTextParagraph>
public java.util.List<XSLFSlide> getSlides()
getSlides
in interface SlideShow<XSLFShape,XSLFTextParagraph>
public java.util.List<XSLFChart> getCharts()
public XSLFCommentAuthors getCommentAuthors()
public void setSlideOrder(XSLFSlide slide, int newIndex)
newIndex
- 0-based index of the slidepublic XSLFSlide removeSlide(int index)
public java.awt.Dimension getPageSize()
SlideShow
getPageSize
in interface SlideShow<XSLFShape,XSLFTextParagraph>
public void setPageSize(java.awt.Dimension pgSize)
SlideShow
setPageSize
in interface SlideShow<XSLFShape,XSLFTextParagraph>
pgSize
- page size (in points)@Internal public org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation getCTPresentation()
public XSLFPictureData addPicture(byte[] pictureData, PictureData.PictureType format)
addPicture
in interface SlideShow<XSLFShape,XSLFTextParagraph>
pictureData
- The bytes of the pictureformat
- The format of the picture.public XSLFPictureData addPicture(java.io.InputStream is, PictureData.PictureType format) throws java.io.IOException
addPicture
in interface SlideShow<XSLFShape,XSLFTextParagraph>
is
- The stream to read image fromformat
- The format of the picturejava.io.IOException
public XSLFPictureData addPicture(java.io.File pict, PictureData.PictureType format) throws java.io.IOException
addPicture
in interface SlideShow<XSLFShape,XSLFTextParagraph>
pict
- The file containing the image to addformat
- The format of the picture.java.io.IOException
public XSLFPictureData findPictureData(byte[] pictureData)
findPictureData
in interface SlideShow<XSLFShape,XSLFTextParagraph>
pictureData
- The picture data to find in the SlideShownull
if picture data is not found in this slideshowpublic XSLFSlideLayout findLayout(java.lang.String name)
name
- The layout name (case-insensitive). Cannot be null.public XSLFTableStyles getTableStyles()
public MasterSheet<XSLFShape,XSLFTextParagraph> createMasterSheet() throws java.io.IOException
createMasterSheet
in interface SlideShow<XSLFShape,XSLFTextParagraph>
java.io.IOException
public POIXMLPropertiesTextExtractor getMetadataTextExtractor()
getMetadataTextExtractor
in interface SlideShow<XSLFShape,XSLFTextParagraph>
public java.lang.Object getPersistDocument()
getPersistDocument
in interface SlideShow<XSLFShape,XSLFTextParagraph>
POIDocument
or POIXMLDocument
public XSLFFontInfo addFont(java.io.InputStream fontStream) throws java.io.IOException
SlideShow
(Older?) Powerpoint versions handle embedded fonts by converting them to .ttf files and put them into the Windows fonts directory. If the user is not allowed to install fonts, the slideshow can't be opened. While the slideshow is opened, its possible to copy the extracted .ttfs from the fonts directory. When the slideshow is closed, they will be removed.
addFont
in interface SlideShow<XSLFShape,XSLFTextParagraph>
fontStream
- the EOT font as streamjava.io.IOException
- if the fontData can't be saved or if the fontData is no EOT fontpublic java.util.List<XSLFFontInfo> getFonts()
getFonts
in interface SlideShow<XSLFShape,XSLFTextParagraph>
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.