Package org.apache.poi.sl.usermodel
Interface TextRun
-
public interface TextRunSome text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTextRun.FieldTypeType of placeholder fieldsstatic classTextRun.TextCapType 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.FieldTypegetFieldType()Experimental method to determine the field type, e.g.PaintStylegetFontColor()Returns the font color.StringgetFontFamily()Get the font family - convenience method forgetFontInfo(FontGroup)StringgetFontFamily(FontGroup fontGroup)Get the font family - convenience method forgetFontInfo(FontGroup)FontInfogetFontInfo(FontGroup fontGroup)Get the font info for the given font groupDoublegetFontSize()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()bytegetPitchAndFamily()StringgetRawText()TextRun.TextCapgetTextCap()booleanisBold()booleanisItalic()booleanisStrikethrough()booleanisSubscript()booleanisSuperscript()booleanisUnderlined()voidsetBold(boolean bold)Sets the bold statevoidsetFontColor(Color color)Sets the (solid) font color - convenience functionvoidsetFontColor(PaintStyle color)Sets the font colorvoidsetFontFamily(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 namevoidsetFontFamily(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 namevoidsetFontInfo(FontInfo fontInfo, FontGroup fontGroup)Specifies the font to be used for this text run.voidsetFontSize(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 layoutvoidsetItalic(boolean italic)Sets the italic statevoidsetStrikethrough(boolean stroked)Sets the strikethrough statevoidsetText(String text)voidsetUnderlined(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 ofnullremoves 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 ofnullremoves 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
nullif 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 ofnullremoves 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
nullif text run is not a field
-
getParagraph
TextParagraph<?,?,?> getParagraph()
- Returns:
- the paragraph which contains this TextRun
- Since:
- POI 4.1.0
-
-