Package org.apache.poi.xslf.usermodel
Class XSLFSheet
- java.lang.Object
-
- org.apache.poi.ooxml.POIXMLDocumentPart
-
- org.apache.poi.xslf.usermodel.XSLFSheet
-
- All Implemented Interfaces:
java.lang.Iterable<XSLFShape>
,ShapeContainer<XSLFShape,XSLFTextParagraph>
,Sheet<XSLFShape,XSLFTextParagraph>
,XSLFShapeContainer
- Direct Known Subclasses:
XSLFNotes
,XSLFNotesMaster
,XSLFSlide
,XSLFSlideLayout
,XSLFSlideMaster
@Beta public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addShape(XSLFShape shape)
XSLFSheet
appendContent(XSLFSheet src)
Append content to this sheet.void
clear()
Removes all of the elements from this container (optional operation).XSLFAutoShape
createAutoShape()
create a new shape with a predefined geometry and add it to this shape containerXSLFConnectorShape
createConnector()
create a connectorXSLFFreeformShape
createFreeform()
create a new shape with a custom geometryXSLFGroupShape
createGroup()
create a group of shapes belonging to this containerXSLFObjectShape
createOleShape(PictureData pictureData)
Create a new OLE object shape with the given pictureData as preview imageXSLFPictureShape
createPicture(PictureData pictureData)
create a picture belonging to this containerXSLFTable
createTable()
XSLFTable
createTable(int numRows, int numCols)
Create a new Table of the given number of rows and columnsXSLFTextBox
createTextBox()
create a text boxvoid
draw(java.awt.Graphics2D graphics)
Render this sheet into the supplied graphics objectXSLFBackground
getBackground()
boolean
getFollowMasterGraphics()
XSLFTextShape
getPlaceholder(int idx)
XSLFSimpleShape
getPlaceholder(Placeholder ph)
XSLFPlaceholderDetails
getPlaceholderDetails(Placeholder placeholder)
Get the placeholder details for the given placeholder type.XSLFTextShape[]
getPlaceholders()
java.util.List<XSLFShape>
getShapes()
Returns an array containing all of the shapes in this sheetXMLSlideShow
getSlideShow()
XSLFTheme
getTheme()
abstract XmlObject
getXmlObject()
XSLFSheet
importContent(XSLFSheet src)
Set the contents of this sheet to be a copy of the source sheet.java.util.Iterator<XSLFShape>
iterator()
Returns an iterator over the shapes in this sheetboolean
removeShape(XSLFShape xShape)
Removes the specified shape from this sheet, if it is present (optional operation).-
Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, isCommited, setCommited, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.poi.sl.usermodel.Sheet
getMasterSheet
-
-
-
-
Method Detail
-
getSlideShow
public XMLSlideShow getSlideShow()
- Specified by:
getSlideShow
in interfaceSheet<XSLFShape,XSLFTextParagraph>
- Returns:
- the XMLSlideShow this sheet belongs to
-
getXmlObject
public abstract XmlObject getXmlObject()
- Returns:
- top-level Xml bean representing this sheet
-
getShapes
public java.util.List<XSLFShape> getShapes()
Returns an array containing all of the shapes in this sheet- Specified by:
getShapes
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Returns:
- an array of all shapes in this sheet
-
createAutoShape
public XSLFAutoShape createAutoShape()
Description copied from interface:ShapeContainer
create a new shape with a predefined geometry and add it to this shape container- Specified by:
createAutoShape
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Specified by:
createAutoShape
in interfaceXSLFShapeContainer
-
createFreeform
public XSLFFreeformShape createFreeform()
Description copied from interface:ShapeContainer
create a new shape with a custom geometry- Specified by:
createFreeform
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Specified by:
createFreeform
in interfaceXSLFShapeContainer
-
createTextBox
public XSLFTextBox createTextBox()
Description copied from interface:ShapeContainer
create a text box- Specified by:
createTextBox
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Specified by:
createTextBox
in interfaceXSLFShapeContainer
-
createConnector
public XSLFConnectorShape createConnector()
Description copied from interface:ShapeContainer
create a connector- Specified by:
createConnector
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Specified by:
createConnector
in interfaceXSLFShapeContainer
-
createGroup
public XSLFGroupShape createGroup()
Description copied from interface:ShapeContainer
create a group of shapes belonging to this container- Specified by:
createGroup
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Specified by:
createGroup
in interfaceXSLFShapeContainer
-
createPicture
public XSLFPictureShape createPicture(PictureData pictureData)
Description copied from interface:ShapeContainer
create a picture belonging to this container- Specified by:
createPicture
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Specified by:
createPicture
in interfaceXSLFShapeContainer
-
createTable
public XSLFTable createTable()
-
createTable
public XSLFTable createTable(int numRows, int numCols)
Description copied from interface:ShapeContainer
Create a new Table of the given number of rows and columns- Specified by:
createTable
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Parameters:
numRows
- the number of rowsnumCols
- the number of columns
-
createOleShape
public XSLFObjectShape createOleShape(PictureData pictureData)
Description copied from interface:ShapeContainer
Create a new OLE object shape with the given pictureData as preview image- Specified by:
createOleShape
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Parameters:
pictureData
- the preview image
-
iterator
public java.util.Iterator<XSLFShape> iterator()
Returns an iterator over the shapes in this sheet- Specified by:
iterator
in interfacejava.lang.Iterable<XSLFShape>
- Returns:
- an iterator over the shapes in this sheet
-
addShape
public void addShape(XSLFShape shape)
- Specified by:
addShape
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
-
removeShape
public boolean removeShape(XSLFShape xShape)
Removes the specified shape from this sheet, if it is present (optional operation). If this sheet does not contain the element, it is unchanged.- Specified by:
removeShape
in interfaceShapeContainer<XSLFShape,XSLFTextParagraph>
- Parameters:
xShape
- shape to be removed from this sheet, if present- Returns:
- true if this sheet contained the specified element
- Throws:
java.lang.IllegalArgumentException
- if the type of the specified shape is incompatible with this sheet (optional)
-
clear
public void clear()
Removes all of the elements from this container (optional operation). The container will be empty after this call returns.- Specified by:
clear
in interfaceXSLFShapeContainer
-
importContent
public XSLFSheet importContent(XSLFSheet src)
Set the contents of this sheet to be a copy of the source sheet. This method erases any existing shapes and replaces them with object from the source sheet.- Parameters:
src
- the source sheet to copy data from- Returns:
- modified 'this'
-
appendContent
public XSLFSheet appendContent(XSLFSheet src)
Append content to this sheet.- Parameters:
src
- the source sheet- Returns:
- modified
this
.
-
getTheme
public XSLFTheme getTheme()
- Returns:
- theme (shared styles) associated with this theme.
By default returns
null
which means that this sheet is theme-less. Sheets that support the notion of themes (slides, masters, layouts, etc.) should override this method and return the corresponding package part.
-
getPlaceholder
public XSLFSimpleShape getPlaceholder(Placeholder ph)
-
getPlaceholder
public XSLFTextShape getPlaceholder(int idx)
- Parameters:
idx
- 0-based index of a placeholder in the sheet- Returns:
- placeholder
-
getPlaceholders
public XSLFTextShape[] getPlaceholders()
- Returns:
- all placeholder shapes in this sheet
-
getFollowMasterGraphics
public boolean getFollowMasterGraphics()
- Specified by:
getFollowMasterGraphics
in interfaceSheet<XSLFShape,XSLFTextParagraph>
- Returns:
- whether shapes on the master sheet should be shown. By default master graphics is turned off. Sheets that support the notion of master (slide, slideLayout) should override it and check this setting in the sheet XML
-
getBackground
public XSLFBackground getBackground()
- Specified by:
getBackground
in interfaceSheet<XSLFShape,XSLFTextParagraph>
- Returns:
- background for this sheet
-
draw
public void draw(java.awt.Graphics2D graphics)
Render this sheet into the supplied graphics object- Specified by:
draw
in interfaceSheet<XSLFShape,XSLFTextParagraph>
- Parameters:
graphics
- the graphics context to draw to
-
getPlaceholderDetails
public XSLFPlaceholderDetails getPlaceholderDetails(Placeholder placeholder)
Description copied from interface:Sheet
Get the placeholder details for the given placeholder type. Not all placeholders are also shapes - this is especially true for old HSLF slideshows, which notes have header/footers elements which aren't shapes.- Specified by:
getPlaceholderDetails
in interfaceSheet<XSLFShape,XSLFTextParagraph>
- Parameters:
placeholder
- the placeholder type- Returns:
- the placeholder details or
null
, if the placeholder isn't contained in the sheet
-
-