org.apache.poi.sl.usermodel

## Interface TextRun

- All Known Implementing Classes:
    HSLFTextRun, XSLFTextRun

      public interface TextRun

  Some text.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `TextRun.FieldType` Type of placeholder fields
    `static class` | `TextRun.TextCap` Type of text capitals

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and 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.
    `java.lang.String` | `getFontFamily()` Get the font family - convenience method for `getFontInfo(FontGroup)`
    `java.lang.String` | `getFontFamily(FontGroup fontGroup)` Get the font family - convenience method for `getFontInfo(FontGroup)`
    `FontInfo` | `getFontInfo(FontGroup fontGroup)` Get the font info for the given font group
    `java.lang.Double` | `getFontSize()` Returns the font size which is either set directly on this text run or given from the slide layout
    `Hyperlink<?,?>` | `getHyperlink()` Return the associated hyperlink
    `TextParagraph<?,?,?>` | `getParagraph()`
    `byte` | `getPitchAndFamily()`
    `java.lang.String` | `getRawText()`
    `TextRun.TextCap` | `getTextCap()`
    `boolean` | `isBold()`
    `boolean` | `isItalic()`
    `boolean` | `isStrikethrough()`
    `boolean` | `isSubscript()`
    `boolean` | `isSuperscript()`
    `boolean` | `isUnderlined()`
    `void` | `setBold(boolean bold)` Sets the bold state
    `void` | `setFontColor(java.awt.Color color)` Sets the (solid) font color - convenience function
    `void` | `setFontColor(PaintStyle color)` Sets the font color
    `void` | `setFontFamily(java.lang.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
    `void` | `setFontFamily(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 calling `setFontInfo(FontInfo, FontGroup)` with just a font name
    `void` | `setFontInfo(FontInfo fontInfo, FontGroup fontGroup)` Specifies the font to be used for this text run.
    `void` | `setFontSize(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 layout
    `void` | `setItalic(boolean italic)` Sets the italic state
    `void` | `setStrikethrough(boolean stroked)` Sets the strikethrough state
    `void` | `setText(java.lang.String text)`
    `void` | `setUnderlined(boolean underlined)` Sets the underlined state

- - ### Method Detail

    - #### getRawText

          java.lang.String getRawText()

    - #### setText

          void setText(java.lang.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:
        `DrawPaint.getPaint(java.awt.Graphics2D, PaintStyle)`, `PaintStyle.SolidPaint.getSolidColor()`, `DrawPaint.applyColorTransform(ColorStyle)`

    - #### setFontColor

          void setFontColor(java.awt.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

          java.lang.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(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 layout
      Parameters:
        `fontSize` - font size in points, if null the underlying fontsize will be unset

    - #### getFontFamily

          java.lang.String getFontFamily()

      Get the font family - convenience method for `getFontInfo(FontGroup)`
      Returns:
        font family or null if not set

    - #### getFontFamily

          java.lang.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(java.lang.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(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 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

          @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

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.