public interface TextShape<S extends Shape<S,P>,P extends TextParagraph<S,P,? extends TextRun>> extends SimpleShape<S,P>, java.lang.Iterable<P>
Modifier and Type | Interface and Description |
---|---|
static class |
TextShape.TextAutofit
Specifies alist of auto-fit types.
|
static class |
TextShape.TextDirection
Vertical Text Types
|
static class |
TextShape.TextPlaceholder
This enum represents a compromise for the handling of
HSLF run types (see org.apache.poi.hslf.record.TextHeaderAtom) and
XSLF placeholders (see org.apache.poi.xslf.usermodel.Placeholder).
|
Modifier and Type | Method and Description |
---|---|
TextRun |
appendText(java.lang.String text,
boolean newParagraph)
Adds the supplied text onto the end of the TextParagraphs,
creating a new RichTextRun for it to sit in.
|
Insets2D |
getInsets() |
java.lang.String |
getText()
Returns the text contained in this text frame, which has been made safe
for printing and other use.
|
TextShape.TextDirection |
getTextDirection() |
double |
getTextHeight()
Compute the cumulative height occupied by the text
|
double |
getTextHeight(java.awt.Graphics2D graphics)
Compute the cumulative height occupied by the text
|
java.util.List<P> |
getTextParagraphs() |
TextShape.TextPlaceholder |
getTextPlaceholder() |
java.lang.Double |
getTextRotation()
The text rotation can be independent specified from the shape rotation.
|
VerticalAlignment |
getVerticalAlignment()
Returns the type of vertical alignment for the text.
|
boolean |
getWordWrap() |
boolean |
isHorizontalCentered()
Returns if the text is centered.
|
java.awt.geom.Rectangle2D |
resizeToFitText()
Adjust the size of the shape so it encompasses the text inside it.
|
java.awt.geom.Rectangle2D |
resizeToFitText(java.awt.Graphics2D graphics)
Adjust the size of the shape so it encompasses the text inside it.
|
void |
setHorizontalCentered(java.lang.Boolean isCentered)
Sets if the paragraphs are horizontal centered
|
void |
setInsets(Insets2D insets)
Sets the shape margins
|
TextRun |
setText(java.lang.String text)
Sets (overwrites) the current text.
|
void |
setTextDirection(TextShape.TextDirection orientation)
sets the vertical orientation
|
void |
setTextPlaceholder(TextShape.TextPlaceholder placeholder)
Sets the text placeholder
|
void |
setTextRotation(java.lang.Double rotation)
Sets the text rotation.
|
void |
setVerticalAlignment(VerticalAlignment vAlign)
Sets the type of vertical alignment for the text.
|
void |
setWordWrap(boolean wrap) |
createHyperlink, getFillColor, getFillStyle, getGeometry, getHyperlink, getLineDecoration, getPlaceholder, getPlaceholderDetails, getShadow, getShapeType, getStrokeStyle, isPlaceholder, setFillColor, setPlaceholder, setShapeType, setStrokeStyle
draw, getAnchor, getParent, getShapeId, getShapeName, getSheet
getAdjustValue
getAnchor, getFlipHorizontal, getFlipVertical, getParent, getRotation, getSheet, setAnchor, setFlipHorizontal, setFlipVertical, setRotation
java.lang.String getText()
TextRun setText(java.lang.String text)
text
- the text string used by this object.TextRun appendText(java.lang.String text, boolean newParagraph)
text
- the text string to be appended.newParagraph
- if true, a new paragraph will be added,
which will contain the added textjava.util.List<P> getTextParagraphs()
Insets2D getInsets()
void setInsets(Insets2D insets)
insets
- the new shape marginsdouble getTextHeight()
double getTextHeight(java.awt.Graphics2D graphics)
graphics
- a customized graphics context, e.g. which contains font mappingsVerticalAlignment getVerticalAlignment()
void setVerticalAlignment(VerticalAlignment vAlign)
vAlign
- - the type of alignment.
A null
values unsets this property.boolean isHorizontalCentered()
void setHorizontalCentered(java.lang.Boolean isCentered)
isCentered
- true, if the paragraphs are horizontal centered
A null
values unsets this property.boolean getWordWrap()
void setWordWrap(boolean wrap)
wrap
- whether to wrap words within the bounding rectangleTextShape.TextDirection getTextDirection()
void setTextDirection(TextShape.TextDirection orientation)
orientation
- vertical orientation of the textjava.lang.Double getTextRotation()
void setTextRotation(java.lang.Double rotation)
rotation
- the text rotation, or null to unset the rotationvoid setTextPlaceholder(TextShape.TextPlaceholder placeholder)
TextShape.TextPlaceholder getTextPlaceholder()
java.awt.geom.Rectangle2D resizeToFitText()
Rectangle2D
that is the bounds of this shape.java.awt.geom.Rectangle2D resizeToFitText(java.awt.Graphics2D graphics)
graphics
- a customized graphics context, e.g. which contains font mappingsRectangle2D
that is the bounds of this shape.Copyright 2022 The Apache Software Foundation or its licensors, as applicable.