Documentation of 'org.apache.poi.xslf.usermodel.XSLFTextParagraph' Java class
XSLFTextParagraph
org.apache.poi.xslf.usermodel

Class XSLFTextParagraph

  • All Implemented Interfaces:
    java.lang.Iterable<XSLFTextRun>


    @Beta
    public class XSLFTextParagraph
    extends java.lang.Object
    implements java.lang.Iterable<XSLFTextRun>
    Represents a paragraph of text within the containing text body. The paragraph is the highest level text separation mechanism.
    Since:
    POI-3.8
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      XSLFTextRun addLineBreak()
      Insert a line break
      XSLFTextRun addNewTextRun()
      Add a new run of text
      void addTabStop(double value) 
      double draw(java.awt.Graphics2D graphics, double x, double y) 
      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() 
      double getLineSpacing()
      Returns the vertical line spacing that is to be used within a paragraph.
      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.
      java.util.List<XSLFTextRun> getTextRuns() 
      org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph getXmlObject() 
      boolean isBullet()
      Returns whether this paragraph has bullets
      java.util.Iterator<XSLFTextRun> iterator() 
      void setBullet(boolean flag) 
      void setBulletAutoNumber(ListAutoNumber scheme, int startAt)
      Specifies that automatic numbered bullet points should be applied to this paragraph
      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 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.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        equals, 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()
      • getTextRuns

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

        public java.util.Iterator<XSLFTextRun> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<XSLFTextRun>
      • addNewTextRun

        public XSLFTextRun addNewTextRun()
        Add a new run of text
        Returns:
        a new run of text
      • addLineBreak

        public XSLFTextRun 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
      • 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.
      • 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
      • getLeftMargin

        public double getLeftMargin()
        Returns:
        the left 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)
      • 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 SlideMaster.
        Parameters:
        level - the level (0 ... 4)
      • getLevel

        public int getLevel()
        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)
        Parameters:
        flag - whether text in this paragraph has bullets
      • setBulletAutoNumber

        public void setBulletAutoNumber(ListAutoNumber scheme,
                                        int startAt)
        Specifies that automatic numbered bullet points should be applied to this paragraph
        Parameters:
        scheme - type of auto-numbering
        startAt - the number that will start number for a given sequence of automatically numbered bullets (1-based).
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • draw

        public double draw(java.awt.Graphics2D graphics,
                           double x,
                           double y)

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.