org.apache.poi.xssf.usermodel

## Class XSSFTextParagraph

- java.lang.Object
- - org.apache.poi.xssf.usermodel.XSSFTextParagraph

- All Implemented Interfaces:
    java.lang.Iterable<XSSFTextRun>

      public class XSSFTextParagraph
      extends java.lang.Object
      implements java.lang.Iterable<XSSFTextRun>

  Represents a paragraph of text within the containing text body. The paragraph is the highest level text separation mechanism.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `XSSFTextRun` | `addLineBreak()` Insert a line break
    `XSSFTextRun` | `addNewTextRun()` Add a new run of text
    `void` | `addTabStop(double value)` Add a single tab stop to be used on a line of text when there are one or more tab characters present within the text.
    `ListAutoNumber` | `getBulletAutoNumberScheme()` Returns the auto number scheme if this paragraph has automatic numbered bullets, otherwise returns ListAutoNumber.ARABIC_PLAIN
    `int` | `getBulletAutoNumberStart()` Returns the starting number if this paragraph has automatic numbered bullets, otherwise returns 0
    `java.lang.String` | `getBulletCharacter()`
    `java.lang.String` | `getBulletFont()`
    `java.awt.Color` | `getBulletFontColor()`
    `double` | `getBulletFontSize()` Returns the bullet size that is to be used within a paragraph.
    `double` | `getDefaultTabSize()`
    `double` | `getIndent()`
    `double` | `getLeftMargin()`
    `int` | `getLevel()` Returns the level of text properties that this paragraph will follow.
    `double` | `getLineSpacing()` Returns the vertical line spacing that is to be used within a paragraph.
    `org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape` | `getParentShape()`
    `double` | `getRightMargin()`
    `double` | `getSpaceAfter()` The amount of vertical white space after the paragraph This may be specified in two different ways, percentage spacing and font point spacing:
    `double` | `getSpaceBefore()` The amount of vertical white space before the paragraph This may be specified in two different ways, percentage spacing and font point spacing:
    `double` | `getTabStop(int idx)`
    `java.lang.String` | `getText()`
    `TextAlign` | `getTextAlign()` Returns the alignment that is applied to the paragraph.
    `TextFontAlign` | `getTextFontAlign()` Returns where vertically on a line of text the actual words are positioned.
    `java.util.List<XSSFTextRun>` | `getTextRuns()`
    `org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph` | `getXmlObject()`
    `boolean` | `isBullet()` Returns whether this paragraph has bullets
    `boolean` | `isBulletAutoNumber()` Returns whether this paragraph has automatic numbered bullets
    `java.util.Iterator<XSSFTextRun>` | `iterator()`
    `void` | `setBullet(boolean flag)` Set or unset this paragraph as a bullet point
    `void` | `setBullet(ListAutoNumber scheme)` Set this paragraph as an automatic numbered bullet point
    `void` | `setBullet(ListAutoNumber scheme, int startAt)` Set this paragraph as an automatic numbered bullet point
    `void` | `setBulletCharacter(java.lang.String str)`
    `void` | `setBulletFont(java.lang.String typeface)`
    `void` | `setBulletFontColor(java.awt.Color color)` Set the color to be used on bullet characters within a given paragraph.
    `void` | `setBulletFontSize(double bulletSize)` Sets the bullet size that is to be used within a paragraph.
    `void` | `setIndent(double value)` Specifies the indent size that will be applied to the first line of text in the paragraph.
    `void` | `setLeftMargin(double value)` Specifies the left margin of the paragraph.
    `void` | `setLevel(int level)` Specifies the particular level text properties that this paragraph will follow.
    `void` | `setLineSpacing(double linespacing)` This element specifies the vertical line spacing that is to be used within a paragraph.
    `void` | `setRightMargin(double value)` Specifies the right margin of the paragraph.
    `void` | `setSpaceAfter(double spaceAfter)` Set the amount of vertical white space that will be present after the paragraph.
    `void` | `setSpaceBefore(double spaceBefore)` Set the amount of vertical white space that will be present before the paragraph.
    `void` | `setTextAlign(TextAlign align)` Specifies the alignment that is to be applied to the paragraph.
    `void` | `setTextFontAlign(TextFontAlign align)` Determines where vertically on a line of text the actual words are positioned.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Method Detail

    - #### getText

          public java.lang.String getText()

    - #### getXmlObject

          @Internal
          public org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph getXmlObject()

    - #### getParentShape

          @Internal
          public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape getParentShape()

    - #### getTextRuns

          public java.util.List<XSSFTextRun> getTextRuns()

    - #### iterator

          public java.util.Iterator<XSSFTextRun> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<XSSFTextRun>`

    - #### addNewTextRun

          public XSSFTextRun addNewTextRun()

      Add a new run of text
      Returns:
        a new run of text

    - #### addLineBreak

          public XSSFTextRun addLineBreak()

      Insert a line break
      Returns:
        text run representing this line break ('\n')

    - #### getTextAlign

          public TextAlign getTextAlign()

      Returns the alignment that is applied to the paragraph. If this attribute is omitted, then a value of left is implied.
      Returns:
        alignment that is applied to the paragraph

    - #### setTextAlign

          public void setTextAlign(TextAlign align)

      Specifies the alignment that is to be applied to the paragraph. Possible values for this include left, right, centered, justified and distributed, see `TextAlign`.
      Parameters:
        `align` - text align

    - #### getTextFontAlign

          public TextFontAlign getTextFontAlign()

      Returns where vertically on a line of text the actual words are positioned. This deals with vertical placement of the characters with respect to the baselines. If this attribute is omitted, then a value of baseline is implied.
      Returns:
        alignment that is applied to the paragraph

    - #### setTextFontAlign

          public void setTextFontAlign(TextFontAlign align)

      Determines where vertically on a line of text the actual words are positioned. This deals with vertical placement of the characters with respect to the baselines. For instance having text anchored to the top baseline, anchored to the bottom baseline, centered in between, etc.
      Parameters:
        `align` - text font align

    - #### getBulletFont

          public java.lang.String getBulletFont()

      Returns:
        the font to be used on bullet characters within a given paragraph

    - #### setBulletFont

          public void setBulletFont(java.lang.String typeface)

    - #### getBulletCharacter

          public java.lang.String getBulletCharacter()

      Returns:
        the character to be used in place of the standard bullet point

    - #### setBulletCharacter

          public void setBulletCharacter(java.lang.String str)

    - #### getBulletFontColor

          public java.awt.Color getBulletFontColor()

      Returns:
        the color of bullet characters within a given paragraph. A `null` value means to use the text font color.

    - #### setBulletFontColor

          public void setBulletFontColor(java.awt.Color color)

      Set the color to be used on bullet characters within a given paragraph.
      Parameters:
        `color` - the bullet color

    - #### getBulletFontSize

          public double getBulletFontSize()

      Returns the bullet size that is to be used within a paragraph. This may be specified in two different ways, percentage spacing and font point spacing:

      If bulletSize >= 0, then bulletSize is a percentage of the font size. If bulletSize < 0, then it specifies the size in points

      Returns:
        the bullet size

    - #### setBulletFontSize

          public void setBulletFontSize(double bulletSize)

      Sets the bullet size that is to be used within a paragraph. This may be specified in two different ways, percentage spacing and font point spacing:

      If bulletSize >= 0, then bulletSize is a percentage of the font size. If bulletSize < 0, then it specifies the size in points

    - #### setIndent

          public void setIndent(double value)

      Specifies the indent size that will be applied to the first line of text in the paragraph.
      Parameters:
        `value` - the indent in points, -1 to unset indent and use the default of 0.

    - #### getIndent

          public double getIndent()

      Returns:
        the indent applied to the first line of text in the paragraph.

    - #### setLeftMargin

          public void setLeftMargin(double value)

      Specifies the left margin of the paragraph. This is specified in addition to the text body inset and applies only to this text paragraph. That is the text body inset and the LeftMargin attributes are additive with respect to the text position.
      Parameters:
        `value` - the left margin of the paragraph, -1 to clear the margin and use the default of 0.

    - #### getLeftMargin

          public double getLeftMargin()

      Returns:
        the left margin of the paragraph

    - #### setRightMargin

          public void setRightMargin(double value)

      Specifies the right margin of the paragraph. This is specified in addition to the text body inset and applies only to this text paragraph. That is the text body inset and the marR attributes are additive with respect to the text position.
      Parameters:
        `value` - the right margin of the paragraph, -1 to clear the margin and use the default of 0.

    - #### getRightMargin

          public double getRightMargin()

      Returns:
        the right margin of the paragraph

    - #### getDefaultTabSize

          public double getDefaultTabSize()

      Returns:
        the default size for a tab character within this paragraph in points

    - #### getTabStop

          public double getTabStop(int idx)

    - #### addTabStop

          public void addTabStop(double value)

      Add a single tab stop to be used on a line of text when there are one or more tab characters present within the text.
      Parameters:
        `value` - the position of the tab stop relative to the left margin

    - #### setLineSpacing

          public void setLineSpacing(double linespacing)

      This element specifies the vertical line spacing that is to be used within a paragraph. This may be specified in two different ways, percentage spacing and font point spacing:

      If linespacing >= 0, then linespacing is a percentage of normal line height If linespacing < 0, the absolute value of linespacing is the spacing in points

      Examples:

                // spacing will be 120% of the size of the largest text on each line
                paragraph.setLineSpacing(120);

                // spacing will be 200% of the size of the largest text on each line
                paragraph.setLineSpacing(200);

                // spacing will be 48 points
                paragraph.setLineSpacing(-48.0);

      Parameters:
        `linespacing` - the vertical line spacing

    - #### getLineSpacing

          public double getLineSpacing()

      Returns the vertical line spacing that is to be used within a paragraph. This may be specified in two different ways, percentage spacing and font point spacing:

      If linespacing >= 0, then linespacing is a percentage of normal line height. If linespacing < 0, the absolute value of linespacing is the spacing in points

      Returns:
        the vertical line spacing.

    - #### setSpaceBefore

          public void setSpaceBefore(double spaceBefore)

      Set the amount of vertical white space that will be present before the paragraph. This space is specified in either percentage or points:

      If spaceBefore >= 0, then space is a percentage of normal line height. If spaceBefore < 0, the absolute value of linespacing is the spacing in points

      Examples:

                // The paragraph will be formatted to have a spacing before the paragraph text.
                // The spacing will be 200% of the size of the largest text on each line
                paragraph.setSpaceBefore(200);

                // The spacing will be a size of 48 points
                paragraph.setSpaceBefore(-48.0);

      Parameters:
        `spaceBefore` - the vertical white space before the paragraph.

    - #### getSpaceBefore

          public double getSpaceBefore()

      The amount of vertical white space before the paragraph This may be specified in two different ways, percentage spacing and font point spacing:

      If spaceBefore >= 0, then space is a percentage of normal line height. If spaceBefore < 0, the absolute value of linespacing is the spacing in points

      Returns:
        the vertical white space before the paragraph

    - #### setSpaceAfter

          public void setSpaceAfter(double spaceAfter)

      Set the amount of vertical white space that will be present after the paragraph. This space is specified in either percentage or points:

      If spaceAfter >= 0, then space is a percentage of normal line height. If spaceAfter < 0, the absolute value of linespacing is the spacing in points

      Examples:

                // The paragraph will be formatted to have a spacing after the paragraph text.
                // The spacing will be 200% of the size of the largest text on each line
                paragraph.setSpaceAfter(200);

                // The spacing will be a size of 48 points
                paragraph.setSpaceAfter(-48.0);

      Parameters:
        `spaceAfter` - the vertical white space after the paragraph.

    - #### getSpaceAfter

          public double getSpaceAfter()

      The amount of vertical white space after the paragraph This may be specified in two different ways, percentage spacing and font point spacing:

      If spaceBefore >= 0, then space is a percentage of normal line height. If spaceBefore < 0, the absolute value of linespacing is the spacing in points

      Returns:
        the vertical white space after the paragraph

    - #### setLevel

          public void setLevel(int level)

      Specifies the particular level text properties that this paragraph will follow. The value for this attribute formats the text according to the corresponding level paragraph properties defined in the list of styles associated with the body of text that this paragraph belongs to (therefore in the parent shape).

      Note that the closest properties object to the text is used, therefore if there is a conflict between the text paragraph properties and the list style properties for this level then the text paragraph properties will take precedence.

      Parameters:
        `level` - the level (0 ... 4)

    - #### getLevel

          public int getLevel()

      Returns the level of text properties that this paragraph will follow.
      Returns:
        the text level of this paragraph (0-based). Default is 0.

    - #### isBullet

          public boolean isBullet()

      Returns whether this paragraph has bullets

    - #### setBullet

          public void setBullet(boolean flag)

      Set or unset this paragraph as a bullet point
      Parameters:
        `flag` - whether text in this paragraph has bullets

    - #### setBullet

          public void setBullet(ListAutoNumber scheme,
                                int startAt)

      Set this paragraph as an automatic numbered bullet point
      Parameters:
        `scheme` - type of auto-numbering
        `startAt` - the number that will start number for a given sequence of automatically numbered bullets (1-based).

    - #### setBullet

          public void setBullet(ListAutoNumber scheme)

      Set this paragraph as an automatic numbered bullet point
      Parameters:
        `scheme` - type of auto-numbering

    - #### isBulletAutoNumber

          public boolean isBulletAutoNumber()

      Returns whether this paragraph has automatic numbered bullets

    - #### getBulletAutoNumberStart

          public int getBulletAutoNumberStart()

      Returns the starting number if this paragraph has automatic numbered bullets, otherwise returns 0

    - #### getBulletAutoNumberScheme

          public ListAutoNumber getBulletAutoNumberScheme()

      Returns the auto number scheme if this paragraph has automatic numbered bullets, otherwise returns ListAutoNumber.ARABIC_PLAIN

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

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