@Beta public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph>
POIXMLDocumentPart.RelationPart
Modifier | Constructor and Description |
---|---|
protected |
XSLFSheet() |
protected |
XSLFSheet(PackagePart part) |
Modifier and Type | Method and Description |
---|---|
void |
addChart(XSLFChart chart)
this method will add chart into slide
with default height, width, x and y
|
void |
addChart(XSLFChart chart,
java.awt.geom.Rectangle2D rect2D)
this method will add chart into slide
with given height, width, x and y
|
void |
addShape(XSLFShape shape) |
protected int |
allocateShapeId() |
XSLFSheet |
appendContent(XSLFSheet src)
Append content to this sheet.
|
protected static java.util.List<XSLFShape> |
buildShapes(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape spTree,
XSLFShapeContainer parent) |
void |
clear()
Removes all of the elements from this container (optional operation).
|
protected void |
commit()
Save the content in the underlying package part.
|
XSLFAutoShape |
createAutoShape()
create a new shape with a predefined geometry and add it to this shape container
|
XSLFConnectorShape |
createConnector()
create a connector
|
XSLFFreeformShape |
createFreeform()
create a new shape with a custom geometry
|
XSLFGroupShape |
createGroup()
create a group of shapes belonging to this container
|
XSLFObjectShape |
createOleShape(PictureData pictureData)
Create a new OLE object shape with the given pictureData as preview image
|
XSLFPictureShape |
createPicture(PictureData pictureData)
create a picture belonging to this container
|
XSLFTable |
createTable() |
XSLFTable |
createTable(int numRows,
int numCols)
Create a new Table of the given number of rows and columns
|
XSLFTextBox |
createTextBox()
create a text box
|
protected void |
deregisterShapeId(int shapeId) |
void |
draw(java.awt.Graphics2D graphics)
Render this sheet into the supplied graphics object
|
XSLFBackground |
getBackground() |
boolean |
getFollowMasterGraphics() |
XSLFSimpleShape |
getPlaceholder(org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder ph) |
XSLFTextShape |
getPlaceholder(int idx) |
XSLFSimpleShape |
getPlaceholder(Placeholder ph) |
XSLFPlaceholderDetails |
getPlaceholderDetails(Placeholder placeholder)
Get the placeholder details for the given placeholder type.
|
XSLFTextShape[] |
getPlaceholders() |
protected abstract java.lang.String |
getRootElementName() |
java.util.List<XSLFShape> |
getShapes()
Returns an array containing all of the shapes in this sheet
|
XMLSlideShow |
getSlideShow() |
protected org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape |
getSpTree() |
protected XSLFTextShape |
getTextShapeByType(Placeholder type) |
XSLFTheme |
getTheme() |
abstract org.apache.xmlbeans.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 sheet
|
protected java.lang.String |
mapSchemeColor(org.openxmlformats.schemas.drawingml.x2006.main.CTColorMappingOverride cmapOver,
java.lang.String schemeColor) |
protected java.lang.String |
mapSchemeColor(org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping cmap,
java.lang.String schemeColor) |
protected void |
registerShapeId(int shapeId) |
boolean |
removeShape(XSLFShape xShape)
Removes the specified shape from this sheet, if it is present
(optional operation).
|
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getMasterSheet
protected XSLFSheet()
protected XSLFSheet(PackagePart part)
public XMLSlideShow getSlideShow()
getSlideShow
in interface Sheet<XSLFShape,XSLFTextParagraph>
protected int allocateShapeId()
protected void registerShapeId(int shapeId)
protected void deregisterShapeId(int shapeId)
protected static java.util.List<XSLFShape> buildShapes(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape spTree, XSLFShapeContainer parent)
public abstract org.apache.xmlbeans.XmlObject getXmlObject()
public java.util.List<XSLFShape> getShapes()
getShapes
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
public XSLFAutoShape createAutoShape()
ShapeContainer
createAutoShape
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
createAutoShape
in interface XSLFShapeContainer
public XSLFFreeformShape createFreeform()
ShapeContainer
createFreeform
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
createFreeform
in interface XSLFShapeContainer
public XSLFTextBox createTextBox()
ShapeContainer
createTextBox
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
createTextBox
in interface XSLFShapeContainer
public XSLFConnectorShape createConnector()
ShapeContainer
createConnector
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
createConnector
in interface XSLFShapeContainer
public XSLFGroupShape createGroup()
ShapeContainer
createGroup
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
createGroup
in interface XSLFShapeContainer
public XSLFPictureShape createPicture(PictureData pictureData)
ShapeContainer
createPicture
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
createPicture
in interface XSLFShapeContainer
public XSLFTable createTable()
public XSLFTable createTable(int numRows, int numCols)
ShapeContainer
createTable
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
numRows
- the number of rowsnumCols
- the number of columnspublic XSLFObjectShape createOleShape(PictureData pictureData)
ShapeContainer
createOleShape
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
pictureData
- the preview imagepublic java.util.Iterator<XSLFShape> iterator()
iterator
in interface java.lang.Iterable<XSLFShape>
public void addShape(XSLFShape shape)
addShape
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
public boolean removeShape(XSLFShape xShape)
removeShape
in interface ShapeContainer<XSLFShape,XSLFTextParagraph>
xShape
- shape to be removed from this sheet, if presenttrue
if this sheet contained the specified elementjava.lang.IllegalArgumentException
- if the type of the specified shape
is incompatible with this sheet (optional)public void clear()
clear
in interface XSLFShapeContainer
protected abstract java.lang.String getRootElementName()
protected org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape getSpTree()
protected final 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 XSLFSheet importContent(XSLFSheet src)
src
- the source sheet to copy data frompublic XSLFSheet appendContent(XSLFSheet src)
src
- the source sheetthis
.public XSLFTheme getTheme()
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.protected XSLFTextShape getTextShapeByType(Placeholder type)
public XSLFSimpleShape getPlaceholder(Placeholder ph)
@Internal public XSLFSimpleShape getPlaceholder(org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder ph)
public XSLFTextShape getPlaceholder(int idx)
idx
- 0-based index of a placeholder in the sheetpublic XSLFTextShape[] getPlaceholders()
public boolean getFollowMasterGraphics()
getFollowMasterGraphics
in interface Sheet<XSLFShape,XSLFTextParagraph>
public XSLFBackground getBackground()
getBackground
in interface Sheet<XSLFShape,XSLFTextParagraph>
public void draw(java.awt.Graphics2D graphics)
draw
in interface Sheet<XSLFShape,XSLFTextParagraph>
graphics
- the graphics context to draw topublic XSLFPlaceholderDetails getPlaceholderDetails(Placeholder placeholder)
Sheet
getPlaceholderDetails
in interface Sheet<XSLFShape,XSLFTextParagraph>
placeholder
- the placeholder typenull
, if the placeholder isn't contained in the sheetpublic void addChart(XSLFChart chart)
chart
- xslf chart objectpublic void addChart(XSLFChart chart, java.awt.geom.Rectangle2D rect2D)
chart
- xslf chart objectprotected java.lang.String mapSchemeColor(org.openxmlformats.schemas.drawingml.x2006.main.CTColorMappingOverride cmapOver, java.lang.String schemeColor)
protected java.lang.String mapSchemeColor(org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping cmap, java.lang.String schemeColor)
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.