org.apache.poi.xslf.usermodel
Class XSLFTextParagraph

java.lang.Object
  extended by org.apache.poi.xslf.usermodel.XSLFTextParagraph
All Implemented Interfaces:
java.lang.Iterable<XSLFTextRun>, TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

@Beta
public class XSLFTextParagraph
extends java.lang.Object
implements TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

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

Since:
POI-3.8

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.TextParagraph
TextParagraph.BulletStyle, TextParagraph.FontAlign, TextParagraph.TextAlign
 
Method Summary
 XSLFTextRun addLineBreak()
          Insert a line break
 XSLFTextRun addNewTextRun()
          Add a new run of text
 void addTabStop(double value)
           
 AutoNumberingScheme getAutoNumberingScheme()
           
 java.lang.Integer getAutoNumberingStartAt()
           
 java.lang.String getBulletCharacter()
           
 java.lang.String getBulletFont()
           
 PaintStyle getBulletFontColor()
           
 java.lang.Double getBulletFontSize()
          Returns the bullet size that is to be used within a paragraph.
 TextParagraph.BulletStyle getBulletStyle()
           
 java.lang.String getDefaultFontFamily()
           
 java.lang.Double getDefaultFontSize()
           
 java.lang.Double getDefaultTabSize()
           
 TextParagraph.FontAlign getFontAlign()
           
 java.lang.Double getIndent()
           
 int getIndentLevel()
           
 java.lang.Double getLeftMargin()
           
 java.lang.Double getLineSpacing()
           
 XSLFTextShape getParentShape()
           
 java.lang.Double getRightMargin()
           
 java.lang.Double getSpaceAfter()
           
 java.lang.Double getSpaceBefore()
           
 double getTabStop(int idx)
           
 java.lang.String getText()
           
 TextParagraph.TextAlign getTextAlign()
           
 java.util.List<XSLFTextRun> getTextRuns()
           
 org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph getXmlObject()
           
 boolean isBullet()
          Returns whether this paragraph has bullets
 boolean isHeaderOrFooter()
           
 java.util.Iterator<XSLFTextRun> iterator()
           
protected  XSLFTextRun newTextRun(org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun r)
          Helper method to allow subclasses to provide their own text run
 void setBullet(boolean flag)
           
 void setBulletAutoNumber(AutoNumberingScheme 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)
           
 void setBulletFontColor(PaintStyle 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 setBulletStyle(java.lang.Object... styles)
           
 void setFontAlign(TextParagraph.FontAlign align)
          Specifies the font alignment that is to be applied to the paragraph.
 void setIndent(java.lang.Double indent)
           
 void setIndentLevel(int level)
           
 void setLeftMargin(java.lang.Double leftMargin)
           
 void setLineSpacing(java.lang.Double lineSpacing)
           
 void setRightMargin(java.lang.Double rightMargin)
           
 void setSpaceAfter(java.lang.Double spaceAfter)
           
 void setSpaceBefore(java.lang.Double spaceBefore)
           
 void setTextAlign(TextParagraph.TextAlign align)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getText

public java.lang.String getText()

getXmlObject

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

getParentShape

public XSLFTextShape getParentShape()
Specified by:
getParentShape in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getTextRuns

public java.util.List<XSLFTextRun> getTextRuns()
Specified by:
getTextRuns in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

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 TextParagraph.TextAlign getTextAlign()
Specified by:
getTextAlign in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

setTextAlign

public void setTextAlign(TextParagraph.TextAlign align)
Specified by:
setTextAlign in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getFontAlign

public TextParagraph.FontAlign getFontAlign()
Specified by:
getFontAlign in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

setFontAlign

public void setFontAlign(TextParagraph.FontAlign align)
Specifies the font alignment that is to be applied to the paragraph. Possible values for this include auto, top, center, baseline and bottom. see TextParagraph.FontAlign.

Parameters:
align - 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 PaintStyle 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)

setBulletFontColor

public void setBulletFontColor(PaintStyle color)
Set the color to be used on bullet characters within a given paragraph.

Parameters:
color - the bullet color

getBulletFontSize

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


getAutoNumberingScheme

public AutoNumberingScheme getAutoNumberingScheme()
Returns:
the auto numbering scheme, or null if not defined

getAutoNumberingStartAt

public java.lang.Integer getAutoNumberingStartAt()
Returns:
the auto numbering starting number, or null if not defined

setIndent

public void setIndent(java.lang.Double indent)
Specified by:
setIndent in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getIndent

public java.lang.Double getIndent()
Specified by:
getIndent in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

setLeftMargin

public void setLeftMargin(java.lang.Double leftMargin)
Specified by:
setLeftMargin in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getLeftMargin

public java.lang.Double getLeftMargin()
Specified by:
getLeftMargin in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
Returns:
the left margin (in points) of the paragraph, null if unset

setRightMargin

public void setRightMargin(java.lang.Double rightMargin)
Specified by:
setRightMargin in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getRightMargin

public java.lang.Double getRightMargin()
Specified by:
getRightMargin in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
Returns:
the right margin of the paragraph, null if unset

getDefaultTabSize

public java.lang.Double getDefaultTabSize()
Specified by:
getDefaultTabSize in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getTabStop

public double getTabStop(int idx)

addTabStop

public void addTabStop(double value)

setLineSpacing

public void setLineSpacing(java.lang.Double lineSpacing)
Specified by:
setLineSpacing in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getLineSpacing

public java.lang.Double getLineSpacing()
Specified by:
getLineSpacing in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

setSpaceBefore

public void setSpaceBefore(java.lang.Double spaceBefore)
Specified by:
setSpaceBefore in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getSpaceBefore

public java.lang.Double getSpaceBefore()
Specified by:
getSpaceBefore in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

setSpaceAfter

public void setSpaceAfter(java.lang.Double spaceAfter)
Specified by:
setSpaceAfter in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getSpaceAfter

public java.lang.Double getSpaceAfter()
Specified by:
getSpaceAfter in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

setIndentLevel

public void setIndentLevel(int level)
Specified by:
setIndentLevel in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getIndentLevel

public int getIndentLevel()
Specified by:
getIndentLevel in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

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(AutoNumberingScheme 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

getDefaultFontSize

public java.lang.Double getDefaultFontSize()
Specified by:
getDefaultFontSize in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getDefaultFontFamily

public java.lang.String getDefaultFontFamily()
Specified by:
getDefaultFontFamily in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

getBulletStyle

public TextParagraph.BulletStyle getBulletStyle()
Specified by:
getBulletStyle in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

setBulletStyle

public void setBulletStyle(java.lang.Object... styles)
Specified by:
setBulletStyle in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

isHeaderOrFooter

public boolean isHeaderOrFooter()
Specified by:
isHeaderOrFooter in interface TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>

newTextRun

protected XSLFTextRun newTextRun(org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun r)
Helper method to allow subclasses to provide their own text run

Parameters:
r - the xml reference
Returns:
a new text paragraph
Since:
POI 3.15-beta2