Package org.apache.poi.sl.usermodel
Interface TextRun
- All Known Implementing Classes:
HSLFTextRun
,XSLFTextRun
public interface TextRun
Some text.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Type of placeholder fieldsstatic enum
Type of text capitals -
Method Summary
Modifier and TypeMethodDescriptionHyperlink
<?, ?> Creates a new hyperlink and assigns it to this text run.Experimental method to determine the field type, e.g.Returns the font color.Get the font family - convenience method forgetFontInfo(FontGroup)
getFontFamily
(FontGroup fontGroup) Get the font family - convenience method forgetFontInfo(FontGroup)
getFontInfo
(FontGroup fontGroup) Get the font info for the given font groupReturns the font size which is either set directly on this text run or given from the slide layoutHyperlink
<?, ?> Return the associated hyperlinkbyte
boolean
isBold()
boolean
isItalic()
boolean
boolean
boolean
boolean
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
void
setUnderlined
(boolean underlined) Sets the underlined state
-
Method Details
-
getRawText
String getRawText() -
setText
-
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:
-
setFontColor
Sets the (solid) font color - convenience function- Parameters:
color
- the color
-
setFontColor
Sets the font color- Parameters:
color
- the color- See Also:
-
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
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
Get the font family - convenience method forgetFontInfo(FontGroup)
- Parameters:
fontGroup
- the font group, i.e. the range of glpyhs to be covered. ifnull
, the font group matching the first character will be returned- Returns:
- font family or null if not set
-
setFontFamily
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
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 glpyhs to be covered. ifnull
, the font group matching the first character will be returned
-
getFontInfo
Get the font info for the given font group- Parameters:
fontGroup
- the font group, i.e. the range of glpyhs 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
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 glpyhs 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
Experimental method to determine the field type, e.g. slide number- Returns:
- the field type or
null
if text run is not a field
-