Interface TextRun

All Known Implementing Classes:
HSLFTextRun, XSLFTextRun

public interface TextRun
Some text.
  • Method Details

    • getRawText

      String getRawText()
    • setText

      void setText(String text)
    • getTextCap

      TextRun.TextCap getTextCap()
    • getFontColor

      PaintStyle getFontColor()
      Returns the font color. This usually returns a PaintStyle.SolidPaint, but but also other classes are possible
      Returns:
      the font color/paint
      See Also:
    • 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:
    • 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 for getFontInfo(FontGroup)
      Returns:
      font family or null if not set
    • getFontFamily

      String getFontFamily(FontGroup fontGroup)
      Get the font family - convenience method for getFontInfo(FontGroup)
      Parameters:
      fontGroup - the font group, i.e. the range of glpyhs to be covered. if null, 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 calling setFontInfo(FontInfo, FontGroup) with just a font name
      Parameters:
      typeface - the font to apply to this text run. The value of null 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 calling setFontInfo(FontInfo, FontGroup) with just a font name
      Parameters:
      typeface - the font to apply to this text run. The value of null 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. if null, 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 glpyhs to be covered. if null, 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 of null 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, if null.
      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