Package org.apache.poi.hslf.usermodel
Class HSLFTextRun
- java.lang.Object
 - 
- org.apache.poi.hslf.usermodel.HSLFTextRun
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.TextRun
TextRun.FieldType, TextRun.TextCap 
 - 
 
- 
Constructor Summary
Constructors Constructor Description HSLFTextRun(HSLFTextParagraph parentParagraph)Create a new wrapper around a rich text string 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HSLFHyperlinkcreateHyperlink()Creates a new hyperlink and assigns it to this text run.TextPropCollectiongetCharacterStyle()TextRun.FieldTypegetFieldType()Experimental method to determine the field type, e.g.PaintStyle.SolidPaintgetFontColor()Returns the font color.java.lang.StringgetFontFamily()Get the font family - convenience method forTextRun.getFontInfo(FontGroup)java.lang.StringgetFontFamily(FontGroup fontGroup)Get the font family - convenience method forTextRun.getFontInfo(FontGroup)intgetFontIndex()Gets the font indexHSLFFontInfogetFontInfo(FontGroup fontGroup)Get the font info for the given font groupjava.lang.DoublegetFontSize()Returns the font size which is either set directly on this text run or given from the slide layoutHSLFHyperlinkgetHyperlink()Return the associated hyperlinkintgetLength()Get the length of the textbytegetPitchAndFamily()java.lang.StringgetRawText()Fetch the text, in raw storage formintgetSuperscript()Gets the subscript/superscript optionTextRun.TextCapgetTextCap()HSLFTextParagraphgetTextParagraph()booleanisBold()booleanisEmbossed()Is this text embossed?booleanisItalic()booleanisShadowed()Does the text have a shadow?booleanisStrikethrough()booleanisSubscript()booleanisSuperscript()booleanisUnderlined()voidsetBold(boolean bold)Sets the bold statevoidsetCharacterStyle(TextPropCollection characterStyle)voidsetCharTextPropVal(java.lang.String propName, java.lang.Integer val)Sets the value of the given Paragraph TextProp, add if requiredvoidsetEmbossed(boolean flag)Is this text embossed?voidsetFontColor(int bgr)Sets color of the text, as a int bgr.voidsetFontColor(java.awt.Color color)Sets the (solid) font color - convenience functionvoidsetFontColor(PaintStyle color)Sets the font colorvoidsetFontFamily(java.lang.String typeface)Specifies the typeface, or name of the font that is to be used for this text run - convenience method for callingTextRun.setFontInfo(FontInfo, FontGroup)with just a font namevoidsetFontFamily(java.lang.String typeface, FontGroup fontGroup)Specifies the typeface, or name of the font that is to be used for this text run - convenience method for callingTextRun.setFontInfo(FontInfo, FontGroup)with just a font namevoidsetFontIndex(int idx)Sets the font indexvoidsetFontInfo(FontInfo fontInfo, FontGroup fontGroup)Specifies the font to be used for this text run.voidsetFontSize(java.lang.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 statevoidsetShadowed(boolean flag)Does the text have a shadow?voidsetStrikethrough(boolean flag)Sets the strikethrough statevoidsetSuperscript(int val)Sets the subscript/superscript optionvoidsetText(java.lang.String text)Change the textvoidsetUnderlined(boolean underlined)Sets the underlined statevoidupdateSheet()Supply the SlideShow we belong to 
 - 
 
- 
- 
Constructor Detail
- 
HSLFTextRun
public HSLFTextRun(HSLFTextParagraph parentParagraph)
Create a new wrapper around a rich text string- Parameters:
 parentParagraph- the parent paragraph
 
 - 
 
- 
Method Detail
- 
getCharacterStyle
public TextPropCollection getCharacterStyle()
 
- 
setCharacterStyle
public void setCharacterStyle(TextPropCollection characterStyle)
 
- 
updateSheet
public void updateSheet()
Supply the SlideShow we belong to 
- 
getLength
public int getLength()
Get the length of the text 
- 
getRawText
public java.lang.String getRawText()
Fetch the text, in raw storage form- Specified by:
 getRawTextin interfaceTextRun
 
- 
setText
public void setText(java.lang.String text)
Change the text 
- 
setCharTextPropVal
public void setCharTextPropVal(java.lang.String propName, java.lang.Integer val)Sets the value of the given Paragraph TextProp, add if required- Parameters:
 propName- The name of the Paragraph TextPropval- The value to set for the TextProp
 
- 
isBold
public boolean isBold()
 
- 
setBold
public void setBold(boolean bold)
Description copied from interface:TextRunSets the bold state 
- 
isItalic
public boolean isItalic()
 
- 
setItalic
public void setItalic(boolean italic)
Description copied from interface:TextRunSets the italic state 
- 
isUnderlined
public boolean isUnderlined()
- Specified by:
 isUnderlinedin interfaceTextRun- Returns:
 - true, if text is underlined
 
 
- 
setUnderlined
public void setUnderlined(boolean underlined)
Description copied from interface:TextRunSets the underlined state- Specified by:
 setUnderlinedin interfaceTextRun- Parameters:
 underlined- set to true for underlined text, false for no underlining
 
- 
isShadowed
public boolean isShadowed()
Does the text have a shadow? 
- 
setShadowed
public void setShadowed(boolean flag)
Does the text have a shadow? 
- 
isEmbossed
public boolean isEmbossed()
Is this text embossed? 
- 
setEmbossed
public void setEmbossed(boolean flag)
Is this text embossed? 
- 
isStrikethrough
public boolean isStrikethrough()
- Specified by:
 isStrikethroughin interfaceTextRun- Returns:
 - true, if text is stroked
 
 
- 
setStrikethrough
public void setStrikethrough(boolean flag)
Description copied from interface:TextRunSets the strikethrough state- Specified by:
 setStrikethroughin interfaceTextRun- Parameters:
 flag- set to true for stroked text, false for no stroking
 
- 
getSuperscript
public int getSuperscript()
Gets the subscript/superscript option- Returns:
 - the percentage of the font size. If the value is positive, it is superscript, otherwise it is subscript
 
 
- 
setSuperscript
public void setSuperscript(int val)
Sets the subscript/superscript option- Parameters:
 val- the percentage of the font size. If the value is positive, it is superscript, otherwise it is subscript
 
- 
getFontSize
public java.lang.Double getFontSize()
Description copied from interface:TextRunReturns the font size which is either set directly on this text run or given from the slide layout- Specified by:
 getFontSizein interfaceTextRun- Returns:
 - font size in points or null if font size is not set.
 
 
- 
setFontSize
public void setFontSize(java.lang.Double fontSize)
Description copied from interface:TextRunSets the font size directly on this text run, if null is given, the font size defaults to the values given from the slide layout- Specified by:
 setFontSizein interfaceTextRun- Parameters:
 fontSize- font size in points, if null the underlying fontsize will be unset
 
- 
getFontIndex
public int getFontIndex()
Gets the font index 
- 
setFontIndex
public void setFontIndex(int idx)
Sets the font index 
- 
setFontFamily
public void setFontFamily(java.lang.String typeface)
Description copied from interface:TextRunSpecifies the typeface, or name of the font that is to be used for this text run - convenience method for callingTextRun.setFontInfo(FontInfo, FontGroup)with just a font name- Specified by:
 setFontFamilyin interfaceTextRun- 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
public void setFontFamily(java.lang.String typeface, FontGroup fontGroup)Description copied from interface:TextRunSpecifies the typeface, or name of the font that is to be used for this text run - convenience method for callingTextRun.setFontInfo(FontInfo, FontGroup)with just a font name- Specified by:
 setFontFamilyin interfaceTextRun- 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 glpyhs to be covered. ifnull, the font group matching the first character will be returned
 
- 
setFontInfo
public void setFontInfo(FontInfo fontInfo, FontGroup fontGroup)
Description copied from interface:TextRunSpecifies the font to be used for this text run.- Specified by:
 setFontInfoin interfaceTextRun- 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 glpyhs to be covered. defaults to latin, ifnull.
 
- 
getFontFamily
public java.lang.String getFontFamily()
Description copied from interface:TextRunGet the font family - convenience method forTextRun.getFontInfo(FontGroup)- Specified by:
 getFontFamilyin interfaceTextRun- Returns:
 - font family or null if not set
 
 
- 
getFontFamily
public java.lang.String getFontFamily(FontGroup fontGroup)
Description copied from interface:TextRunGet the font family - convenience method forTextRun.getFontInfo(FontGroup)- Specified by:
 getFontFamilyin interfaceTextRun- 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
 
 
- 
getFontInfo
public HSLFFontInfo getFontInfo(FontGroup fontGroup)
Description copied from interface:TextRunGet the font info for the given font group- Specified by:
 getFontInfoin interfaceTextRun- 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 
nullif not set 
 
- 
getFontColor
public PaintStyle.SolidPaint getFontColor()
Description copied from interface:TextRunReturns the font color. This usually returns aPaintStyle.SolidPaint, but but also other classes are possible- Specified by:
 getFontColorin interfaceTextRun- Returns:
 - font color as PaintStyle
 - See Also:
 DrawPaint.getPaint(java.awt.Graphics2D, PaintStyle),PaintStyle.SolidPaint.getSolidColor(),DrawPaint.applyColorTransform(ColorStyle)
 
- 
setFontColor
public void setFontColor(int bgr)
Sets color of the text, as a int bgr. (PowerPoint stores as BlueGreenRed, not the more usual RedGreenBlue)- See Also:
 Color
 
- 
setFontColor
public void setFontColor(java.awt.Color color)
Description copied from interface:TextRunSets the (solid) font color - convenience function- Specified by:
 setFontColorin interfaceTextRun- Parameters:
 color- the color
 
- 
setFontColor
public void setFontColor(PaintStyle color)
Description copied from interface:TextRunSets the font color- Specified by:
 setFontColorin interfaceTextRun- Parameters:
 color- the color- See Also:
 DrawPaint.createSolidPaint(Color)
 
- 
getTextParagraph
public HSLFTextParagraph getTextParagraph()
 
- 
getTextCap
public TextRun.TextCap getTextCap()
- Specified by:
 getTextCapin interfaceTextRun
 
- 
isSubscript
public boolean isSubscript()
- Specified by:
 isSubscriptin interfaceTextRun- Returns:
 - true, if text is sub scripted
 
 
- 
isSuperscript
public boolean isSuperscript()
- Specified by:
 isSuperscriptin interfaceTextRun- Returns:
 - true, if text is super scripted
 
 
- 
getPitchAndFamily
public byte getPitchAndFamily()
- Specified by:
 getPitchAndFamilyin interfaceTextRun- Returns:
 - the pitch and family id or -1 if not applicable
 
 
- 
getHyperlink
public HSLFHyperlink getHyperlink()
Description copied from interface:TextRunReturn the associated hyperlink- Specified by:
 getHyperlinkin interfaceTextRun- Returns:
 - the associated hyperlink or null if no hyperlink was set
 
 
- 
createHyperlink
public HSLFHyperlink createHyperlink()
Description copied from interface:TextRunCreates a new hyperlink and assigns it to this text run. If the text run has already a hyperlink assigned, return it instead- Specified by:
 createHyperlinkin interfaceTextRun- Returns:
 - the associated hyperlink
 
 
- 
getFieldType
public TextRun.FieldType getFieldType()
Description copied from interface:TextRunExperimental method to determine the field type, e.g. slide number- Specified by:
 getFieldTypein interfaceTextRun- Returns:
 - the field type or 
nullif text run is not a field 
 
 - 
 
 -