Package org.apache.poi.xslf.usermodel
Class XSLFTableCell
java.lang.Object
org.apache.poi.xslf.usermodel.XSLFShape
org.apache.poi.xslf.usermodel.XSLFSimpleShape
org.apache.poi.xslf.usermodel.XSLFTextShape
org.apache.poi.xslf.usermodel.XSLFTableCell
- All Implemented Interfaces:
Iterable<XSLFTextParagraph>
,IAdjustableShape
,PlaceableShape<XSLFShape,
,XSLFTextParagraph> Shape<XSLFShape,
,XSLFTextParagraph> SimpleShape<XSLFShape,
,XSLFTextParagraph> TableCell<XSLFShape,
,XSLFTextParagraph> TextShape<XSLFShape,
,XSLFTextParagraph> TextContainer
Represents a cell of a table in a .pptx presentation
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.TableCell
TableCell.BorderEdge
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.TextShape
TextShape.TextAutofit, TextShape.TextDirection, TextShape.TextPlaceholder
-
Method Summary
Modifier and TypeMethodDescriptionReturns the anchor (the bounding box rectangle) of this shape.Return line style of given edge ornull
if border is not definedprotected org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties
getCellProperties
(boolean create) Returns the solid color fill.int
Get the number of columns to be spanned/mergedint
Get the number of rows to be spanned/mergedprotected org.apache.xmlbeans.XmlObject
Return the shape specific (visual) propertiesprotected org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody
getTextBody
(boolean create) Returns the type of vertical alignment for the text.protected org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D
getXfrm()
Return a fake-xfrm which is used for calculating the text heightboolean
isMerged()
Return if this cell is part of a merged cell.protected org.apache.poi.xslf.usermodel.XSLFTableCell.XSLFCellTextParagraph
newTextParagraph
(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph p) Helper method to allow subclasses to provide their own text paragraphvoid
Remove all line attributes of the given border edgevoid
setAnchor
(Rectangle2D anchor) There's no real anchor for table cells - this method is used to temporarily store the location of the cell for a later retrieval, e.g.void
setBorderCap
(TableCell.BorderEdge edge, StrokeStyle.LineCap cap) void
setBorderColor
(TableCell.BorderEdge edge, Color color) Convenience method for setting the border color.void
setBorderCompound
(TableCell.BorderEdge edge, StrokeStyle.LineCompound compound) Convenience method for setting the border line compound.void
setBorderDash
(TableCell.BorderEdge edge, StrokeStyle.LineDash dash) Convenience method for setting the border line dash.void
setBorderStyle
(TableCell.BorderEdge edge, StrokeStyle style) Sets theStrokeStyle
of the given border edge.void
setBorderWidth
(TableCell.BorderEdge edge, double width) Convenience method for setting the border width.void
setBottomInset
(double margin) Sets the bottom margin.void
setFillColor
(Color color) Specifies a solid color fill.void
setLeftInset
(double margin) Sets the left margin.void
setRightInset
(double margin) Sets the right margin.void
setTextDirection
(TextShape.TextDirection orientation) sets the vertical orientationvoid
setTopInset
(double margin) Sets the top margin.void
Sets the type of vertical alignment for the text.Methods inherited from class org.apache.poi.xslf.usermodel.XSLFTextShape
addNewTextParagraph, appendText, clearText, findDefinedParagraphProperty, findDefinedRunProperty, getBottomInset, getInsets, getLeftInset, getRightInset, getText, getTextAutofit, getTextBody, getTextBodyPr, getTextBodyPr, getTextHeight, getTextHeight, getTextParagraphs, getTextPlaceholder, getTextRotation, getTextType, getTopInset, getWordWrap, initTextBody, isHorizontalCentered, iterator, resizeToFitText, resizeToFitText, setHorizontalCentered, setInsets, setPlaceholder, setText, setTextAutofit, setTextPlaceholder, setTextRotation, setWordWrap
Methods inherited from class org.apache.poi.xslf.usermodel.XSLFSimpleShape
createHyperlink, getAdjustValue, getFillStyle, getFlipHorizontal, getFlipVertical, getGeometry, getHyperlink, getLineCap, getLineColor, getLineCompound, getLineDash, getLineDecoration, getLineHeadDecoration, getLineHeadLength, getLineHeadWidth, getLinePaint, getLineTailDecoration, getLineTailLength, getLineTailWidth, getLineWidth, getRotation, getShadow, getShapeType, getStrokeStyle, getXfrm, setFlipHorizontal, setFlipVertical, setLineCap, setLineColor, setLineCompound, setLineDash, setLineHeadDecoration, setLineHeadLength, setLineHeadWidth, setLineTailDecoration, setLineTailLength, setLineTailWidth, setLineWidth, setRotation, setShapeType, setStrokeStyle
Methods inherited from class org.apache.poi.xslf.usermodel.XSLFShape
draw, fetchShapeProperty, getBgPr, getBgRef, getChild, getCNvPr, getGrpSpPr, getParent, getPlaceholder, getPlaceholderDetails, getShapeId, getShapeName, getSheet, getSpStyle, getXmlObject, isPlaceholder, selectPaint, selectPaint, selectPaint, selectPaint, selectPaint, selectProperty, setParent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.poi.sl.draw.geom.IAdjustableShape
getAdjustValue
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.apache.poi.sl.usermodel.PlaceableShape
getFlipHorizontal, getFlipVertical, getParent, getRotation, getSheet, setFlipHorizontal, setFlipVertical, setRotation
Methods inherited from interface org.apache.poi.sl.usermodel.Shape
draw, getParent, getShapeId, getShapeName, getSheet
Methods inherited from interface org.apache.poi.sl.usermodel.SimpleShape
createHyperlink, getFillStyle, getGeometry, getHyperlink, getLineDecoration, getPlaceholder, getPlaceholderDetails, getShadow, getShapeType, getStrokeStyle, isPlaceholder, setPlaceholder, setShapeType, setStrokeStyle
Methods inherited from interface org.apache.poi.sl.usermodel.TextShape
appendText, getInsets, getText, getTextHeight, getTextHeight, getTextParagraphs, getTextPlaceholder, getTextRotation, getWordWrap, isHorizontalCentered, resizeToFitText, resizeToFitText, setHorizontalCentered, setInsets, setText, setTextPlaceholder, setTextRotation, setWordWrap
-
Method Details
-
getTextBody
protected org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody getTextBody(boolean create) - Specified by:
getTextBody
in classXSLFTextShape
-
getCellProperties
protected org.openxmlformats.schemas.drawingml.x2006.main.CTTableCellProperties getCellProperties(boolean create) -
setLeftInset
public void setLeftInset(double margin) Description copied from class:XSLFTextShape
Sets the left margin.- Overrides:
setLeftInset
in classXSLFTextShape
- Parameters:
margin
- the left margin- See Also:
-
setRightInset
public void setRightInset(double margin) Description copied from class:XSLFTextShape
Sets the right margin.- Overrides:
setRightInset
in classXSLFTextShape
- Parameters:
margin
- the right margin- See Also:
-
setTopInset
public void setTopInset(double margin) Description copied from class:XSLFTextShape
Sets the top margin.- Overrides:
setTopInset
in classXSLFTextShape
- Parameters:
margin
- the top margin- See Also:
-
setBottomInset
public void setBottomInset(double margin) Description copied from class:XSLFTextShape
Sets the bottom margin.- Overrides:
setBottomInset
in classXSLFTextShape
- Parameters:
margin
- the bottom margin- See Also:
-
removeBorder
Description copied from interface:TableCell
Remove all line attributes of the given border edge- Specified by:
removeBorder
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Parameters:
edge
- the border edge to be cleared
-
getBorderStyle
Description copied from interface:TableCell
Return line style of given edge ornull
if border is not defined- Specified by:
getBorderStyle
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Parameters:
edge
- the border edge- Returns:
- line style of given edge or
null
if border is not defined
-
setBorderStyle
Description copied from interface:TableCell
Sets theStrokeStyle
of the given border edge. Anull
property of the style is ignored.- Specified by:
setBorderStyle
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Parameters:
edge
- border edgestyle
- the new stroke style
-
getBorderWidth
-
setBorderWidth
Description copied from interface:TableCell
Convenience method for setting the border width.- Specified by:
setBorderWidth
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Parameters:
edge
- border edgewidth
- the new border width
-
setBorderColor
Description copied from interface:TableCell
Convenience method for setting the border color.- Specified by:
setBorderColor
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Parameters:
edge
- border edgecolor
- the new border color
-
getBorderColor
-
getBorderCompound
-
setBorderCompound
Description copied from interface:TableCell
Convenience method for setting the border line compound.- Specified by:
setBorderCompound
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Parameters:
edge
- border edgecompound
- the new border line compound
-
getBorderDash
-
setBorderDash
Description copied from interface:TableCell
Convenience method for setting the border line dash.- Specified by:
setBorderDash
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Parameters:
edge
- border edgedash
- the new border line dash
-
getBorderCap
-
setBorderCap
-
setFillColor
Specifies a solid color fill. The shape is filled entirely with the specified color.- Specified by:
setFillColor
in interfaceSimpleShape<XSLFShape,
XSLFTextParagraph> - Overrides:
setFillColor
in classXSLFSimpleShape
- Parameters:
color
- the solid color fill. The value ofnull
unsets the solidFIll attribute from the underlying xml
-
getFillColor
Description copied from interface:SimpleShape
Returns the solid color fill.- Specified by:
getFillColor
in interfaceSimpleShape<XSLFShape,
XSLFTextParagraph> - Overrides:
getFillColor
in classXSLFSimpleShape
- Returns:
- solid fill color of null if not set
-
getFillPaint
- Overrides:
getFillPaint
in classXSLFShape
-
getGridSpan
public int getGridSpan()Description copied from interface:TableCell
Get the number of columns to be spanned/merged- Specified by:
getGridSpan
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Returns:
- the grid span
-
getRowSpan
public int getRowSpan()Description copied from interface:TableCell
Get the number of rows to be spanned/merged- Specified by:
getRowSpan
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Returns:
- the row span
-
setVerticalAlignment
Description copied from interface:TextShape
Sets the type of vertical alignment for the text.- Specified by:
setVerticalAlignment
in interfaceTextShape<XSLFShape,
XSLFTextParagraph> - Overrides:
setVerticalAlignment
in classXSLFTextShape
- Parameters:
anchor
- - the type of alignment. Anull
values unsets this property.
-
getVerticalAlignment
Description copied from interface:TextShape
Returns the type of vertical alignment for the text.- Specified by:
getVerticalAlignment
in interfaceTextShape<XSLFShape,
XSLFTextParagraph> - Overrides:
getVerticalAlignment
in classXSLFTextShape
- Returns:
- the type of vertical alignment
-
setTextDirection
Description copied from interface:TextShape
sets the vertical orientation- Specified by:
setTextDirection
in interfaceTextShape<XSLFShape,
XSLFTextParagraph> - Overrides:
setTextDirection
in classXSLFTextShape
- Parameters:
orientation
- vertical orientation of the text- Since:
- POI 3.15-beta2
-
getTextDirection
- Specified by:
getTextDirection
in interfaceTextShape<XSLFShape,
XSLFTextParagraph> - Overrides:
getTextDirection
in classXSLFTextShape
- Returns:
- vertical orientation of the text
- Since:
- POI 3.15-beta2
-
getXfrm
protected org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D getXfrm()Return a fake-xfrm which is used for calculating the text height -
setAnchor
There's no real anchor for table cells - this method is used to temporarily store the location of the cell for a later retrieval, e.g. for rendering- Specified by:
setAnchor
in interfacePlaceableShape<XSLFShape,
XSLFTextParagraph> - Overrides:
setAnchor
in classXSLFSimpleShape
- Parameters:
anchor
- the position of this shape within the drawing canvas. The coordinates are expressed in points- Since:
- POI 3.15-beta2
-
getAnchor
Description copied from interface:Shape
Returns the anchor (the bounding box rectangle) of this shape. All coordinates are expressed in points (72 dpi).- Specified by:
getAnchor
in interfacePlaceableShape<XSLFShape,
XSLFTextParagraph> - Specified by:
getAnchor
in interfaceShape<XSLFShape,
XSLFTextParagraph> - Overrides:
getAnchor
in classXSLFSimpleShape
- Returns:
- the anchor of this shape
- Since:
- POI 3.15-beta2
-
isMerged
public boolean isMerged()Description copied from interface:TableCell
Return if this cell is part of a merged cell. The top/left cell of a merged region is not regarded as merged - its grid and/or row span is greater than one.- Specified by:
isMerged
in interfaceTableCell<XSLFShape,
XSLFTextParagraph> - Returns:
- true if this a merged cell
- Since:
- POI 3.15-beta2
-
newTextParagraph
protected org.apache.poi.xslf.usermodel.XSLFTableCell.XSLFCellTextParagraph newTextParagraph(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph p) Description copied from class:XSLFTextShape
Helper method to allow subclasses to provide their own text paragraph- Overrides:
newTextParagraph
in classXSLFTextShape
- Parameters:
p
- the xml reference- Returns:
- a new text paragraph
- Since:
- POI 3.15-beta2
-
getShapeProperties
protected org.apache.xmlbeans.XmlObject getShapeProperties()Description copied from class:XSLFShape
Return the shape specific (visual) properties- Overrides:
getShapeProperties
in classXSLFShape
- Returns:
- the shape specific properties
-