Class XWPFParagraph

java.lang.Object
org.apache.poi.xwpf.usermodel.XWPFParagraph
All Implemented Interfaces:
Paragraph, IBodyElement, IRunBody, ISDTContents

public class XWPFParagraph extends Object implements IBodyElement, IRunBody, ISDTContents, Paragraph

A Paragraph within a Document, Table, Header etc.

A paragraph has a lot of styling information, but the actual text (possibly along with more styling) is held on the child XWPFRuns.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected XWPFDocument
    For access to the document's hyperlink, comments, tables etc
    protected List<IRunElement>
     
    protected IBody
     
    protected List<XWPFRun>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    XWPFParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP prgrph, IBody part)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a new run with a reference to the specified footnote.
    void
    adds a new Run to the Paragraph
    protected void
    addRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR run)
    add a new run at the end of the position of the content of parameter run
    Appends a new run to this paragraph
    Returns the paragraph alignment which shall be applied to text in this paragraph.
     
    Specifies the border which shall be displayed between each paragraph in a set of paragraphs which have the same set of paragraph border settings.
    Specifies the border which shall be displayed below a set of paragraphs which have the same set of paragraph border settings.
    Specifies the border which shall be displayed on the left side of the page around the specified paragraph.
    Specifies the border which shall be displayed on the right side of the page around the specified paragraph.
    Specifies the border which shall be displayed above a set of paragraphs which have the same set of paragraph border settings.
    org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP
     
     
    returns the type of the BodyElement Paragraph
    int
     
    int
     
    Returns the footnote text of the paragraph
    int
    Specifies the additional indentation which shall be applied to the first line of the parent paragraph.
    int
    Specifies the indentation which shall be removed from the first line of the parent paragraph, by moving the indentation on the first line back towards the beginning of the direction of text flow.
    int
    Specifies the indentation which shall be placed between the left text margin for this paragraph and the left edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph
    int
    Specifies the indentation which shall be placed between the right text margin for this paragraph and the right edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph
    int
     
    int
     
    Return literal runs and sdt/content control objects.
    Returns numbering format for this paragraph, eg bullet or lowerLetter.
    If style exist for this paragraph NumId of the paragraph will be returned.
    Returns Ilvl of the numeric style for this paragraph.
    Returns the text that should be used around the paragraph level numbers.
    Gets the numstartOverride for the paragraph numbering for this paragraph.
    Returns the text of the paragraph, but not of any objects in the paragraph
    returns the part of the bodyElement
    returns the partType of the bodyPart which owns the bodyElement
    Returns any text from any suitable pictures in the paragraph
    getRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR r)
    return the XWPFRun-Element which owns the CTR run-Element
     
    int
    Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.
    int
    Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.
    int
    Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.
    int
    Specifies the spacing that should be added before the first line in this paragraph in the document in line units.
    double
    Return the spacing between lines of a paragraph.
    Specifies how the spacing between lines is calculated as stored in the line attribute.
     
    Return styleID of the paragraph if style exist for this paragraph if not, null will be returned
    Return the textual content of the paragraph, including text from pictures and sdt elements in it.
    get a Text
    Returns the text vertical alignment which shall be applied to text in this paragraph.
    insertNewRun(int pos)
    insert a new Run in RunArray
    boolean
     
    boolean
    Specifies that when rendering this document in a paginated view, the contents of this paragraph are rendered on the start of a new page in the document.
    boolean
     
    boolean
    This element specifies whether a consumer shall break Latin text which exceeds the text extents of a line by breaking the word across two lines (breaking on the character level) or by moving the word to the following line (breaking on the word level).
    boolean
    removeRun(int pos)
    removes a Run at the position pos in the paragraph
    searchText(String searched, PositionInParagraph startPos)
    this methods parse the paragraph and search for the string searched.
    void
    Specifies the paragraph alignment which shall be applied to text in this paragraph.
    void
    Specifies the border which shall be displayed between each paragraph in a set of paragraphs which have the same set of paragraph border settings.
    void
    Specifies the border which shall be displayed below a set of paragraphs which have the same set of paragraph border settings.
    void
    Specifies the border which shall be displayed on the left side of the page around the specified paragraph.
    void
    Specifies the border which shall be displayed on the right side of the page around the specified paragraph.
    void
    Specifies the border which shall be displayed above a set of paragraphs which have the same set of paragraph border settings.
    void
    setFirstLineIndent(int first)
     
    void
    setFontAlignment(int align)
     
    void
    setIndentationFirstLine(int indentation)
    Specifies the additional indentation which shall be applied to the first line of the parent paragraph.
    void
    setIndentationHanging(int indentation)
    Specifies the indentation which shall be removed from the first line of the parent paragraph, by moving the indentation on the first line back towards the beginning of the direction of text flow.
    void
    setIndentationLeft(int indentation)
    Specifies the indentation which shall be placed between the left text margin for this paragraph and the left edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph
    void
    setIndentationRight(int indentation)
    Specifies the indentation which shall be placed between the right text margin for this paragraph and the right edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph
    void
    setIndentFromLeft(int dxaLeft)
     
    void
    setIndentFromRight(int dxaRight)
     
    void
    setNumID of Paragraph
    void
    setPageBreak(boolean pageBreak)
    Specifies that when rendering this document in a paginated view, the contents of this paragraph are rendered on the start of a new page in the document.
    void
    setSpacingAfter(int spaces)
    Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.
    void
    Specifies the spacing that should be added after the last line in this paragraph in the document in line units.
    void
    setSpacingBefore(int spaces)
    Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.
    void
    Specifies the spacing that should be added before the first line in this paragraph in the document in line units.
    void
    setSpacingBetween(double spacing)
    Sets the spacing between lines in a paragraph
    void
    setSpacingBetween(double spacing, LineSpacingRule rule)
    Sets the spacing between lines in a paragraph
    void
    Specifies how the spacing between lines is calculated as stored in the line attribute.
    void
    setStyle(String styleId)
    Set the style ID for the paragraph
    void
    Specifies the text vertical alignment which shall be applied to text in this paragraph.
    void
    setWordWrap(boolean wrap)
    Deprecated.
    void
    setWordWrapped(boolean wrap)
    This element specifies whether a consumer shall break Latin text which exceeds the text extents of a line by breaking the word across two lines (breaking on the character level) or by moving the word to the following line (breaking on the word level).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • XWPFParagraph

      public XWPFParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP prgrph, IBody part)
  • Method Details

    • getCTP

      @Internal public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP getCTP()
    • getRuns

      public List<XWPFRun> getRuns()
    • getIRuns

      public List<IRunElement> getIRuns()
      Return literal runs and sdt/content control objects.
      Returns:
      List
    • isEmpty

      public boolean isEmpty()
    • getDocument

      public XWPFDocument getDocument()
      Specified by:
      getDocument in interface IRunBody
    • getText

      public String getText()
      Return the textual content of the paragraph, including text from pictures and sdt elements in it.
    • getStyleID

      public String getStyleID()
      Return styleID of the paragraph if style exist for this paragraph if not, null will be returned
      Returns:
      styleID as String
    • getNumID

      public BigInteger getNumID()
      If style exist for this paragraph NumId of the paragraph will be returned. If style not exist null will be returned
      Returns:
      NumID as BigInteger
    • setNumID

      public void setNumID(BigInteger numPos)
      setNumID of Paragraph
      Parameters:
      numPos -
    • getNumIlvl

      public BigInteger getNumIlvl()
      Returns Ilvl of the numeric style for this paragraph. Returns null if this paragraph does not have numeric style.
      Returns:
      Ilvl as BigInteger
    • getNumFmt

      public String getNumFmt()
      Returns numbering format for this paragraph, eg bullet or lowerLetter. Returns null if this paragraph does not have numeric style.
    • getNumLevelText

      public String getNumLevelText()
      Returns the text that should be used around the paragraph level numbers.
      Returns:
      a string (e.g. "%1.") or null if the value is not found.
    • getNumStartOverride

      public BigInteger getNumStartOverride()
      Gets the numstartOverride for the paragraph numbering for this paragraph.
      Returns:
      returns the overridden start number or null if there is no override for this paragraph.
    • getParagraphText

      public String getParagraphText()
      Returns the text of the paragraph, but not of any objects in the paragraph
    • getPictureText

      public String getPictureText()
      Returns any text from any suitable pictures in the paragraph
    • getFootnoteText

      public String getFootnoteText()
      Returns the footnote text of the paragraph
      Returns:
      the footnote text or empty string if the paragraph does not have footnotes
    • getAlignment

      public ParagraphAlignment getAlignment()
      Returns the paragraph alignment which shall be applied to text in this paragraph.

      If this element is not set on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no alignment is applied to the paragraph.

      Returns:
      the paragraph alignment of this paragraph.
    • setAlignment

      public void setAlignment(ParagraphAlignment align)
      Specifies the paragraph alignment which shall be applied to text in this paragraph.

      If this element is not set on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no alignment is applied to the paragraph.

      Parameters:
      align - the paragraph alignment to apply to this paragraph.
    • getFontAlignment

      public int getFontAlignment()
      Specified by:
      getFontAlignment in interface Paragraph
      Returns:
      The raw alignment value, getAlignment() is suggested
    • setFontAlignment

      public void setFontAlignment(int align)
      Specified by:
      setFontAlignment in interface Paragraph
    • getVerticalAlignment

      public TextAlignment getVerticalAlignment()
      Returns the text vertical alignment which shall be applied to text in this paragraph.

      If the line height (before any added spacing) is larger than one or more characters on the line, all characters will be aligned to each other as specified by this element.

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then the vertical alignment of all characters on the line shall be automatically determined by the consumer.

      Returns:
      the vertical alignment of this paragraph.
    • setVerticalAlignment

      public void setVerticalAlignment(TextAlignment valign)
      Specifies the text vertical alignment which shall be applied to text in this paragraph.

      If the line height (before any added spacing) is larger than one or more characters on the line, all characters will be aligned to each other as specified by this element.

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then the vertical alignment of all characters on the line shall be automatically determined by the consumer.

      Parameters:
      valign - the paragraph vertical alignment to apply to this paragraph.
    • getBorderTop

      public Borders getBorderTop()
      Specifies the border which shall be displayed above a set of paragraphs which have the same set of paragraph border settings.
      Returns:
      paragraphBorder - the top border for the paragraph
      See Also:
    • setBorderTop

      public void setBorderTop(Borders border)
      Specifies the border which shall be displayed above a set of paragraphs which have the same set of paragraph border settings.

      To determine if any two adjoining paragraphs shall have an individual top and bottom border or a between border, the set of borders on the two adjoining paragraphs are compared. If the border information on those two paragraphs is identical for all possible paragraphs borders, then the between border is displayed. Otherwise, the final paragraph shall use its bottom border and the following paragraph shall use its top border, respectively. If this border specifies a space attribute, that value determines the space above the text (ignoring any spacing above) which should be left before this border is drawn, specified in points.

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no between border shall be applied above identical paragraphs.

      This border can only be a line border.
      Parameters:
      border -
      See Also:
    • getBorderBottom

      public Borders getBorderBottom()
      Specifies the border which shall be displayed below a set of paragraphs which have the same set of paragraph border settings.
      Returns:
      paragraphBorder - the bottom border for the paragraph
      See Also:
    • setBorderBottom

      public void setBorderBottom(Borders border)
      Specifies the border which shall be displayed below a set of paragraphs which have the same set of paragraph border settings.

      To determine if any two adjoining paragraphs shall have an individual top and bottom border or a between border, the set of borders on the two adjoining paragraphs are compared. If the border information on those two paragraphs is identical for all possible paragraphs borders, then the between border is displayed. Otherwise, the final paragraph shall use its bottom border and the following paragraph shall use its top border, respectively. If this border specifies a space attribute, that value determines the space after the bottom of the text (ignoring any space below) which should be left before this border is drawn, specified in points.

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no between border shall be applied below identical paragraphs.

      This border can only be a line border.
      Parameters:
      border -
      See Also:
    • getBorderLeft

      public Borders getBorderLeft()
      Specifies the border which shall be displayed on the left side of the page around the specified paragraph.
      Returns:
      ParagraphBorder - the left border for the paragraph
      See Also:
    • setBorderLeft

      public void setBorderLeft(Borders border)
      Specifies the border which shall be displayed on the left side of the page around the specified paragraph.

      To determine if any two adjoining paragraphs should have a left border which spans the full line height or not, the left border shall be drawn between the top border or between border at the top (whichever would be rendered for the current paragraph), and the bottom border or between border at the bottom (whichever would be rendered for the current paragraph).

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no left border shall be applied.

      This border can only be a line border.
      Parameters:
      border -
      See Also:
    • getBorderRight

      public Borders getBorderRight()
      Specifies the border which shall be displayed on the right side of the page around the specified paragraph.
      Returns:
      ParagraphBorder - the right border for the paragraph
      See Also:
    • setBorderRight

      public void setBorderRight(Borders border)
      Specifies the border which shall be displayed on the right side of the page around the specified paragraph.

      To determine if any two adjoining paragraphs should have a right border which spans the full line height or not, the right border shall be drawn between the top border or between border at the top (whichever would be rendered for the current paragraph), and the bottom border or between border at the bottom (whichever would be rendered for the current paragraph).

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no right border shall be applied.

      This border can only be a line border.
      Parameters:
      border -
      See Also:
    • getBorderBetween

      public Borders getBorderBetween()
      Specifies the border which shall be displayed between each paragraph in a set of paragraphs which have the same set of paragraph border settings.
      Returns:
      ParagraphBorder - the between border for the paragraph
      See Also:
    • setBorderBetween

      public void setBorderBetween(Borders border)
      Specifies the border which shall be displayed between each paragraph in a set of paragraphs which have the same set of paragraph border settings.

      To determine if any two adjoining paragraphs should have a between border or an individual top and bottom border, the set of borders on the two adjoining paragraphs are compared. If the border information on those two paragraphs is identical for all possible paragraphs borders, then the between border is displayed. Otherwise, each paragraph shall use its bottom and top border, respectively. If this border specifies a space attribute, that value is ignored - this border is always located at the bottom of each paragraph with an identical following paragraph, taking into account any space after the line pitch.

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no between border shall be applied between identical paragraphs.

      This border can only be a line border.
      Parameters:
      border -
      See Also:
    • isPageBreak

      public boolean isPageBreak()
      Specifies that when rendering this document in a paginated view, the contents of this paragraph are rendered on the start of a new page in the document.

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then this property shall not be applied. Since the paragraph is specified to start on a new page, it begins page two even though it could have fit on page one.

      Returns:
      boolean - if page break is set
    • setPageBreak

      public void setPageBreak(boolean pageBreak)
      Specifies that when rendering this document in a paginated view, the contents of this paragraph are rendered on the start of a new page in the document.

      If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then this property shall not be applied. Since the paragraph is specified to start on a new page, it begins page two even though it could have fit on page one.

      Parameters:
      pageBreak - - boolean value
    • getSpacingAfter

      public int getSpacingAfter()
      Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.
      Returns:
      int - value representing the spacing after the paragraph
    • setSpacingAfter

      public void setSpacingAfter(int spaces)
      Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.

      If the afterLines attribute or the afterAutoSpacing attribute is also specified, then this attribute value is ignored.

      Parameters:
      spaces - - a positive whole number, whose contents consist of a measurement in twentieths of a point.
    • getSpacingAfterLines

      public int getSpacingAfterLines()
      Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.
      Returns:
      int - value representing the spacing after the paragraph
      See Also:
    • setSpacingAfterLines

      public void setSpacingAfterLines(int spaces)
      Specifies the spacing that should be added after the last line in this paragraph in the document in line units. The value of this attribute is specified in one hundredths of a line.

      If the afterAutoSpacing attribute is also specified, then this attribute value is ignored. If this setting is never specified in the style hierarchy, then its value shall be zero (if needed)

      Parameters:
      spaces - - a positive whole number, whose contents consist of a measurement in hundredths of a line
    • getSpacingBefore

      public int getSpacingBefore()
      Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.
      Returns:
      the spacing that should be added above the first line
      See Also:
    • setSpacingBefore

      public void setSpacingBefore(int spaces)
      Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.

      If the beforeLines attribute or the beforeAutoSpacing attribute is also specified, then this attribute value is ignored.

      Parameters:
      spaces -
    • getSpacingBeforeLines

      public int getSpacingBeforeLines()
      Specifies the spacing that should be added before the first line in this paragraph in the document in line units. The value of this attribute is specified in one hundredths of a line.
      Returns:
      the spacing that should be added before the first line in this paragraph
      See Also:
    • setSpacingBeforeLines

      public void setSpacingBeforeLines(int spaces)
      Specifies the spacing that should be added before the first line in this paragraph in the document in line units. The value of this attribute is specified in one hundredths of a line.

      If the beforeAutoSpacing attribute is also specified, then this attribute value is ignored. If this setting is never specified in the style hierarchy, then its value shall be zero.

      Parameters:
      spaces -
    • getSpacingLineRule

      public LineSpacingRule getSpacingLineRule()
      Specifies how the spacing between lines is calculated as stored in the line attribute. If this attribute is omitted, then it shall be assumed to be of a value auto if a line attribute value is present.
      Returns:
      rule
      See Also:
    • setSpacingLineRule

      public void setSpacingLineRule(LineSpacingRule rule)
      Specifies how the spacing between lines is calculated as stored in the line attribute. If this attribute is omitted, then it shall be assumed to be of a value auto if a line attribute value is present.
      Parameters:
      rule -
      See Also:
    • getSpacingBetween

      public double getSpacingBetween()
      Return the spacing between lines of a paragraph. The units of the return value depends on the LineSpacingRule. If AUTO, the return value is in lines, otherwise the return value is in points
      Returns:
      a double specifying points or lines.
    • setSpacingBetween

      public void setSpacingBetween(double spacing, LineSpacingRule rule)
      Sets the spacing between lines in a paragraph
      Parameters:
      spacing - - A double specifying spacing in inches or lines. If rule is AUTO, then spacing is in lines. Otherwise spacing is in points.
      rule - - LineSpacingRule indicating how spacing is interpreted. If AUTO, then spacing value is in lines, and the height depends on the font size. If AT_LEAST, then spacing value is in inches, and is the minimum size of the line. If the line height is taller, then the line expands to match. If EXACT, then spacing is the exact line height. If the text is taller than the line height, then it is clipped at the top.
    • setSpacingBetween

      public void setSpacingBetween(double spacing)
      Sets the spacing between lines in a paragraph
      Parameters:
      spacing - - A double specifying spacing in lines.
    • getIndentationLeft

      public int getIndentationLeft()
      Specifies the indentation which shall be placed between the left text margin for this paragraph and the left edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph

      If this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.

      Returns:
      indentation or null if indentation is not set
    • setIndentationLeft

      public void setIndentationLeft(int indentation)
      Specifies the indentation which shall be placed between the left text margin for this paragraph and the left edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph

      If this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.

      Parameters:
      indentation -
    • getIndentationRight

      public int getIndentationRight()
      Specifies the indentation which shall be placed between the right text margin for this paragraph and the right edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph

      If this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.

      Returns:
      indentation or null if indentation is not set
    • setIndentationRight

      public void setIndentationRight(int indentation)
      Specifies the indentation which shall be placed between the right text margin for this paragraph and the right edge of that paragraph's content in a left to right paragraph, and the right text margin and the right edge of that paragraph's text in a right to left paragraph

      If this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.

      Parameters:
      indentation -
    • getIndentationHanging

      public int getIndentationHanging()
      Specifies the indentation which shall be removed from the first line of the parent paragraph, by moving the indentation on the first line back towards the beginning of the direction of text flow. This indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph. The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored.
      Returns:
      indentation or null if indentation is not set
    • setIndentationHanging

      public void setIndentationHanging(int indentation)
      Specifies the indentation which shall be removed from the first line of the parent paragraph, by moving the indentation on the first line back towards the beginning of the direction of text flow. This indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph.

      The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored.

      Parameters:
      indentation -
    • getIndentationFirstLine

      public int getIndentationFirstLine()
      Specifies the additional indentation which shall be applied to the first line of the parent paragraph. This additional indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph. The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored. If the firstLineChars attribute is also specified, then this value is ignored. If this attribute is omitted, then its value shall be assumed to be zero (if needed).
      Returns:
      indentation or null if indentation is not set
    • setIndentationFirstLine

      public void setIndentationFirstLine(int indentation)
      Specifies the additional indentation which shall be applied to the first line of the parent paragraph. This additional indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph. The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored. If the firstLineChars attribute is also specified, then this value is ignored. If this attribute is omitted, then its value shall be assumed to be zero (if needed).
      Parameters:
      indentation -
    • getIndentFromLeft

      public int getIndentFromLeft()
      Specified by:
      getIndentFromLeft in interface Paragraph
    • setIndentFromLeft

      public void setIndentFromLeft(int dxaLeft)
      Specified by:
      setIndentFromLeft in interface Paragraph
    • getIndentFromRight

      public int getIndentFromRight()
      Specified by:
      getIndentFromRight in interface Paragraph
    • setIndentFromRight

      public void setIndentFromRight(int dxaRight)
      Specified by:
      setIndentFromRight in interface Paragraph
    • getFirstLineIndent

      public int getFirstLineIndent()
      Specified by:
      getFirstLineIndent in interface Paragraph
    • setFirstLineIndent

      public void setFirstLineIndent(int first)
      Specified by:
      setFirstLineIndent in interface Paragraph
    • isWordWrapped

      public boolean isWordWrapped()
      This element specifies whether a consumer shall break Latin text which exceeds the text extents of a line by breaking the word across two lines (breaking on the character level) or by moving the word to the following line (breaking on the word level).
      Specified by:
      isWordWrapped in interface Paragraph
      Returns:
      boolean
    • setWordWrapped

      public void setWordWrapped(boolean wrap)
      This element specifies whether a consumer shall break Latin text which exceeds the text extents of a line by breaking the word across two lines (breaking on the character level) or by moving the word to the following line (breaking on the word level).
      Specified by:
      setWordWrapped in interface Paragraph
      Parameters:
      wrap - - boolean
    • isWordWrap

      public boolean isWordWrap()
    • setWordWrap

      @Deprecated public void setWordWrap(boolean wrap)
      Deprecated.
    • getStyle

      public String getStyle()
      Returns:
      the style of the paragraph
    • setStyle

      public void setStyle(String styleId)
      Set the style ID for the paragraph
      Parameters:
      styleId - ID (not name) of the style to set for the paragraph, e.g. "Heading1" (not "Heading 1").
    • addRun

      protected void addRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR run)
      add a new run at the end of the position of the content of parameter run
      Parameters:
      run -
    • createRun

      public XWPFRun createRun()
      Appends a new run to this paragraph
      Returns:
      a new text run
    • insertNewRun

      public XWPFRun insertNewRun(int pos)
      insert a new Run in RunArray
      Parameters:
      pos - The position at which the new run should be added.
      Returns:
      the inserted run or null if the given pos is out of bounds.
    • searchText

      public TextSegment searchText(String searched, PositionInParagraph startPos)
      this methods parse the paragraph and search for the string searched. If it finds the string, it will return true and the position of the String will be saved in the parameter startPos.
      Parameters:
      searched -
      startPos -
    • getText

      public String getText(TextSegment segment)
      get a Text
      Parameters:
      segment -
    • removeRun

      public boolean removeRun(int pos)
      removes a Run at the position pos in the paragraph
      Parameters:
      pos -
      Returns:
      true if the run was removed
    • getElementType

      public BodyElementType getElementType()
      returns the type of the BodyElement Paragraph
      Specified by:
      getElementType in interface IBodyElement
      See Also:
    • getBody

      public IBody getBody()
      Specified by:
      getBody in interface IBodyElement
    • getPart

      public POIXMLDocumentPart getPart()
      returns the part of the bodyElement
      Specified by:
      getPart in interface IBodyElement
      Specified by:
      getPart in interface IRunBody
      See Also:
    • getPartType

      public BodyType getPartType()
      returns the partType of the bodyPart which owns the bodyElement
      Specified by:
      getPartType in interface IBodyElement
      See Also:
    • addRun

      public void addRun(XWPFRun r)
      adds a new Run to the Paragraph
      Parameters:
      r -
    • getRun

      public XWPFRun getRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR r)
      return the XWPFRun-Element which owns the CTR run-Element
      Parameters:
      r -
    • addFootnoteReference

      public void addFootnoteReference(XWPFAbstractFootnoteEndnote footnote)
      Add a new run with a reference to the specified footnote. The footnote reference run will have the style name "FootnoteReference".
      Parameters:
      footnote - Footnote to which to add a reference.
      Since:
      4.0.0