Class XDDFTextParagraph


  • @Beta
    public class XDDFTextParagraph
    extends java.lang.Object
    Represents a paragraph of text within the containing text body. The paragraph is the highest level text separation mechanism.
    • Constructor Detail

      • XDDFTextParagraph

        @Internal
        protected XDDFTextParagraph​(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph paragraph,
                                    XDDFTextBody parent)
    • Method Detail

      • setText

        public void setText​(java.lang.String text)
      • getText

        public java.lang.String getText()
      • getTextRuns

        public java.util.List<XDDFTextRun> getTextRuns()
      • iterator

        public java.util.Iterator<XDDFTextRun> iterator()
      • appendLineBreak

        public XDDFTextRun appendLineBreak()
        Append a line break.
        Returns:
        text run representing this line break ('\n').
      • appendField

        public XDDFTextRun appendField​(java.lang.String id,
                                       java.lang.String type,
                                       java.lang.String text)
        Append a new text field.
        Returns:
        the new text field.
      • appendRegularRun

        public XDDFTextRun appendRegularRun​(java.lang.String text)
        Append a new run of text.
        Returns:
        the new run of text.
      • getTextAlignment

        public TextAlignment getTextAlignment()
        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
      • setTextAlignment

        public void setTextAlignment​(TextAlignment align)
        Specifies the alignment that is to be applied to the paragraph. Possible values for this include left, right, centered, justified and distributed,
        Parameters:
        align - text alignment
      • getFontAlignment

        public FontAlignment getFontAlignment()
        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
      • setFontAlignment

        public void setFontAlignment​(FontAlignment 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 alignment
      • getIndentation

        public java.lang.Double getIndentation()
        Returns:
        the indentation, in points, applied to the first line of text in the paragraph.
      • setIndentation

        public void setIndentation​(java.lang.Double points)
        Specifies the indentation size that will be applied to the first line of text in the paragraph.
        Parameters:
        points - the indentation in points. The value null unsets the indentation for this paragraph.
        Minimum inclusive =
        -4032
        Maximum inclusive =
        4032
      • getMarginLeft

        public java.lang.Double getMarginLeft()
        Returns:
        the left margin, in points, of the paragraph.
      • setMarginLeft

        public void setMarginLeft​(java.lang.Double points)
        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:
        points - the margin in points. The value null unsets the left margin for this paragraph.
        Minimum inclusive =
        0
        Maximum inclusive =
        4032
      • getMarginRight

        public java.lang.Double getMarginRight()
        Returns:
        the right margin, in points, of the paragraph.
      • setMarginRight

        public void setMarginRight​(java.lang.Double points)
        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 RightMargin attributes are additive with respect to the text position.
        Parameters:
        points - the margin in points. The value null unsets the right margin for this paragraph.
        Minimum inclusive =
        0
        Maximum inclusive =
        4032
      • getDefaultTabSize

        public java.lang.Double getDefaultTabSize()
        Returns:
        the default size for a tab character within this paragraph in points.
      • setDefaultTabSize

        public void setDefaultTabSize​(java.lang.Double points)
        Specifies the default size for a tab character within this paragraph.
        Parameters:
        points - the default tab size in points. The value null unsets the default tab size for this paragraph.
      • getLineSpacing

        public XDDFSpacing getLineSpacing()
        Returns the vertical line spacing that is to be used within a paragraph. This may be specified in two different ways, percentage spacing or font points spacing:

        If line spacing is a percentage of normal line height, result is instance of XDDFSpacingPercent. If line spacing is expressed in points, result is instance of XDDFSpacingPoints.

        Returns:
        the vertical line spacing.
      • setLineSpacing

        public void setLineSpacing​(XDDFSpacing 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 or font points spacing:

        If spacing is instance of XDDFSpacingPercent, then line spacing is a percentage of normal line height. If spacing is instance of XDDFSpacingPoints, then line spacing is expressed in points.

        Examples:
         
              // spacing will be 120% of the size of the largest text on each line
              paragraph.setLineSpacing(new XDDFSpacingPercent(120));
        
              // spacing will be 200% of the size of the largest text on each line
              paragraph.setLineSpacing(new XDDFSpacingPercent(200));
        
              // spacing will be 48 points
              paragraph.setLineSpacing(new XDDFSpacingPoints(48.0));
         
         
        Parameters:
        linespacing - the vertical line spacing
      • getSpaceBefore

        public XDDFSpacing getSpaceBefore()
        The amount of vertical white space before the paragraph. This may be specified in two different ways, percentage spacing or font points spacing:

        If spacing is a percentage of normal line height, result is instance of XDDFSpacingPercent. If spacing is expressed in points, result is instance of XDDFSpacingPoints.

        Returns:
        the vertical white space before the paragraph.
      • setSpaceBefore

        public void setSpaceBefore​(XDDFSpacing spaceBefore)
        Set the amount of vertical white space that will be present before the paragraph. This may be specified in two different ways, percentage spacing or font points spacing:

        If spacing is instance of XDDFSpacingPercent, then spacing is a percentage of normal line height. If spacing is instance of XDDFSpacingPoints, then spacing is expressed 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(new XDDFSpacingPercent(200));
        
              // The spacing will be a size of 48 points
              paragraph.setSpaceBefore(new XDDFSpacingPoints(48.0));
         
         
        Parameters:
        spaceBefore - the vertical white space before the paragraph.
      • getSpaceAfter

        public XDDFSpacing getSpaceAfter()
        The amount of vertical white space after the paragraph. This may be specified in two different ways, percentage spacing or font points spacing:

        If spacing is a percentage of normal line height, result is instance of XDDFSpacingPercent. If spacing is expressed in points, result is instance of XDDFSpacingPoints.

        Returns:
        the vertical white space after the paragraph.
      • setSpaceAfter

        public void setSpaceAfter​(XDDFSpacing spaceAfter)
        Set the amount of vertical white space that will be present after the paragraph. This may be specified in two different ways, percentage spacing or font points spacing:

        If spacing is instance of XDDFSpacingPercent, then spacing is a percentage of normal line height. If spacing is instance of XDDFSpacingPoints, then spacing is expressed 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(new XDDFSpacingPercent(200));
        
              // The spacing will be a size of 48 points
              paragraph.setSpaceAfter(new XDDFSpacingPoints(48.0));
         
         
        Parameters:
        spaceAfter - the vertical white space after the paragraph.
      • getBulletColor

        public XDDFColor getBulletColor()
        Returns:
        the color of bullet characters within a given paragraph. A null value means to use the text font color.
      • setBulletColor

        public void setBulletColor​(XDDFColor color)
        Set the color to be used on bullet characters within a given paragraph.
        Parameters:
        color - the bullet color
      • setBulletColorFollowText

        public void setBulletColorFollowText()
        Specifies the color to be used on bullet characters has to follow text color within a given paragraph.
      • getBulletFont

        public XDDFFont getBulletFont()
        Returns:
        the font of bullet characters within a given paragraph. A null value means to use the text font font.
      • setBulletFont

        public void setBulletFont​(XDDFFont font)
        Set the font to be used on bullet characters within a given paragraph.
        Parameters:
        font - the bullet font
      • setBulletFontFollowText

        public void setBulletFontFollowText()
        Specifies the font to be used on bullet characters has to follow text font within a given paragraph.
      • getBulletSize

        public XDDFBulletSize getBulletSize()
        Returns the bullet size that is to be used within a paragraph. This may be specified in three different ways, follows text size, percentage size and font points size:

        If returned value is instance of XDDFBulletSizeFollowText, then bullet size is text size; If returned value is instance of XDDFBulletSizePercent, then bullet size is a percentage of the font size; If returned value is instance of XDDFBulletSizePoints, then bullet size is specified in points.

        Returns:
        the bullet size
      • setBulletSize

        public void setBulletSize​(XDDFBulletSize size)
        Sets the bullet size that is to be used within a paragraph. This may be specified in three different ways, follows text size, percentage size and font points size:

        If given value is instance of XDDFBulletSizeFollowText, then bullet size is text size; If given value is instance of XDDFBulletSizePercent, then bullet size is a percentage of the font size; If given value is instance of XDDFBulletSizePoints, then bullet size is specified in points.

        Parameters:
        size - the bullet size specification
      • hasEastAsianLineBreak

        public boolean hasEastAsianLineBreak()
      • setEastAsianLineBreak

        public void setEastAsianLineBreak​(java.lang.Boolean value)
      • hasLatinLineBreak

        public boolean hasLatinLineBreak()
      • setLatinLineBreak

        public void setLatinLineBreak​(java.lang.Boolean value)
      • hasHangingPunctuation

        public boolean hasHangingPunctuation()
      • setHangingPunctuation

        public void setHangingPunctuation​(java.lang.Boolean value)
      • isRightToLeft

        public boolean isRightToLeft()
      • setRightToLeft

        public void setRightToLeft​(java.lang.Boolean value)
      • insertTabStop

        public XDDFTabStop insertTabStop​(int index)
      • removeTabStop

        public void removeTabStop​(int index)
      • getTabStop

        public XDDFTabStop getTabStop​(int index)
      • getTabStops

        public java.util.List<XDDFTabStop> getTabStops()
      • countTabStops

        public int countTabStops()
      • addDefaultRunProperties

        public XDDFRunProperties addDefaultRunProperties()
        Since:
        4.0.1
      • setDefaultRunProperties

        public void setDefaultRunProperties​(XDDFRunProperties properties)
      • setAfterLastRunProperties

        public void setAfterLastRunProperties​(XDDFRunProperties properties)
      • findDefinedParagraphProperty

        protected <R> java.util.Optional<R> findDefinedParagraphProperty​(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,​java.lang.Boolean> isSet,
                                                                         java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,​R> getter)
      • findDefinedRunProperty

        protected <R> java.util.Optional<R> findDefinedRunProperty​(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,​java.lang.Boolean> isSet,
                                                                   java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,​R> getter)