Package org.apache.poi.sl.usermodel
Interface TextRun
-
public interface TextRun
Some text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
TextRun.FieldType
Type of placeholder fieldsstatic class
TextRun.TextCap
Type of text capitals
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Hyperlink<?,?>
createHyperlink()
Creates a new hyperlink and assigns it to this text run.TextRun.FieldType
getFieldType()
Experimental method to determine the field type, e.g.PaintStyle
getFontColor()
Returns the font color.String
getFontFamily()
Get the font family - convenience method forgetFontInfo(FontGroup)
String
getFontFamily(FontGroup fontGroup)
Get the font family - convenience method forgetFontInfo(FontGroup)
FontInfo
getFontInfo(FontGroup fontGroup)
Get the font info for the given font groupDouble
getFontSize()
Returns the font size which is either set directly on this text run or given from the slide layoutHyperlink<?,?>
getHyperlink()
Return the associated hyperlinkTextParagraph<?,?,?>
getParagraph()
byte
getPitchAndFamily()
String
getRawText()
TextRun.TextCap
getTextCap()
boolean
isBold()
boolean
isItalic()
boolean
isStrikethrough()
boolean
isSubscript()
boolean
isSuperscript()
boolean
isUnderlined()
void
setBold(boolean bold)
Sets the bold statevoid
setFontColor(Color color)
Sets the (solid) font color - convenience functionvoid
setFontColor(PaintStyle color)
Sets the font colorvoid
setFontFamily(String typeface)
Specifies the typeface, or name of the font that is to be used for this text run - convenience method for callingsetFontInfo(FontInfo, FontGroup)
with just a font namevoid
setFontFamily(String typeface, FontGroup fontGroup)
Specifies the typeface, or name of the font that is to be used for this text run - convenience method for callingsetFontInfo(FontInfo, FontGroup)
with just a font namevoid
setFontInfo(FontInfo fontInfo, FontGroup fontGroup)
Specifies the font to be used for this text run.void
setFontSize(Double fontSize)
Sets the font size directly on this text run, if null is given, the font size defaults to the values given from the slide layoutvoid
setItalic(boolean italic)
Sets the italic statevoid
setStrikethrough(boolean stroked)
Sets the strikethrough statevoid
setText(String text)
void
setUnderlined(boolean underlined)
Sets the underlined state
-
-
-
Method Detail
-
getRawText
String getRawText()
-
setText
void setText(String text)
-
getTextCap
TextRun.TextCap getTextCap()
-
getFontColor
PaintStyle getFontColor()
Returns the font color. This usually returns aPaintStyle.SolidPaint
, but but also other classes are possible- Returns:
- the font color/paint
- See Also:
DrawPaint.getPaint(java.awt.Graphics2D, PaintStyle)
,PaintStyle.SolidPaint.getSolidColor()
,DrawPaint.applyColorTransform(ColorStyle)
-
setFontColor
void setFontColor(Color color)
Sets the (solid) font color - convenience function- Parameters:
color
- the color
-
setFontColor
void setFontColor(PaintStyle color)
Sets the font color- Parameters:
color
- the color- See Also:
DrawPaint.createSolidPaint(Color)
-
getFontSize
Double getFontSize()
Returns the font size which is either set directly on this text run or given from the slide layout- Returns:
- font size in points or null if font size is not set.
-
setFontSize
void setFontSize(Double fontSize)
Sets the font size directly on this text run, if null is given, the font size defaults to the values given from the slide layout- Parameters:
fontSize
- font size in points, if null the underlying fontsize will be unset
-
getFontFamily
String getFontFamily()
Get the font family - convenience method forgetFontInfo(FontGroup)
- Returns:
- font family or null if not set
-
getFontFamily
String getFontFamily(FontGroup fontGroup)
Get the font family - convenience method forgetFontInfo(FontGroup)
- Parameters:
fontGroup
- the font group, i.e. the range of glyphs to be covered. ifnull
, the font group matching the first character will be returned- Returns:
- font family or null if not set
-
setFontFamily
void setFontFamily(String typeface)
Specifies the typeface, or name of the font that is to be used for this text run - convenience method for callingsetFontInfo(FontInfo, FontGroup)
with just a font name- Parameters:
typeface
- the font to apply to this text run. The value ofnull
removes the run specific font setting, so the default setting is activated again.
-
setFontFamily
void setFontFamily(String typeface, FontGroup fontGroup)
Specifies the typeface, or name of the font that is to be used for this text run - convenience method for callingsetFontInfo(FontInfo, FontGroup)
with just a font name- Parameters:
typeface
- the font to apply to this text run. The value ofnull
removes the run specific font setting, so the default setting is activated again.fontGroup
- the font group, i.e. the range of glyphs to be covered. ifnull
, the font group matching the first character will be returned
-
getFontInfo
FontInfo getFontInfo(FontGroup fontGroup)
Get the font info for the given font group- Parameters:
fontGroup
- the font group, i.e. the range of glyphs to be covered. ifnull
, the font group matching the first character will be returned- Returns:
- font info or
null
if not set - Since:
- POI 3.17-beta2
-
setFontInfo
void setFontInfo(FontInfo fontInfo, FontGroup fontGroup)
Specifies the font to be used for this text run.- Parameters:
fontInfo
- the font to apply to this text run. The value ofnull
removes the run specific font setting, so the default setting is activated again.fontGroup
- the font group, i.e. the range of glyphs to be covered. defaults to latin, ifnull
.- Since:
- POI 3.17-beta2
-
isBold
boolean isBold()
- Returns:
- true, if text is bold
-
setBold
void setBold(boolean bold)
Sets the bold state- Parameters:
bold
- set to true for bold text, false for normal weight
-
isItalic
boolean isItalic()
- Returns:
- true, if text is italic
-
setItalic
void setItalic(boolean italic)
Sets the italic state- Parameters:
italic
- set to true for italic text, false for non-italics
-
isUnderlined
boolean isUnderlined()
- Returns:
- true, if text is underlined
-
setUnderlined
void setUnderlined(boolean underlined)
Sets the underlined state- Parameters:
underlined
- set to true for underlined text, false for no underlining
-
isStrikethrough
boolean isStrikethrough()
- Returns:
- true, if text is stroked
-
setStrikethrough
void setStrikethrough(boolean stroked)
Sets the strikethrough state- Parameters:
stroked
- set to true for stroked text, false for no stroking
-
isSubscript
boolean isSubscript()
- Returns:
- true, if text is sub scripted
-
isSuperscript
boolean isSuperscript()
- Returns:
- true, if text is super scripted
-
getPitchAndFamily
byte getPitchAndFamily()
- Returns:
- the pitch and family id or -1 if not applicable
-
getHyperlink
Hyperlink<?,?> getHyperlink()
Return the associated hyperlink- Returns:
- the associated hyperlink or null if no hyperlink was set
- Since:
- POI 3.14-Beta2
-
createHyperlink
Hyperlink<?,?> createHyperlink()
Creates a new hyperlink and assigns it to this text run. If the text run has already a hyperlink assigned, return it instead- Returns:
- the associated hyperlink
- Since:
- POI 3.14-Beta2
-
getFieldType
@Internal TextRun.FieldType getFieldType()
Experimental method to determine the field type, e.g. slide number- Returns:
- the field type or
null
if text run is not a field
-
getParagraph
TextParagraph<?,?,?> getParagraph()
- Returns:
- the paragraph which contains this TextRun
- Since:
- POI 4.1.0
-
-