Package org.apache.poi.xslf.usermodel
Class XSLFTextParagraph
- java.lang.Object
-
- org.apache.poi.xslf.usermodel.XSLFTextParagraph
-
- All Implemented Interfaces:
Iterable<XSLFTextRun>,TextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
@Beta public class XSLFTextParagraph extends 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XSLFTextRunaddLineBreak()Insert a line breakXSLFTextRunaddNewTextRun()Add a new run of textvoidaddTabStop(double value)voidaddTabStops(double positionInPoints, TabStop.TabStopType tabStopType)voidclearTabStops()AutoNumberingSchemegetAutoNumberingScheme()IntegergetAutoNumberingStartAt()StringgetBulletCharacter()StringgetBulletFont()PaintStylegetBulletFontColor()DoublegetBulletFontSize()Returns the bullet size that is to be used within a paragraph.TextParagraph.BulletStylegetBulletStyle()StringgetDefaultFontFamily()DoublegetDefaultFontSize()org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphPropertiesgetDefaultMasterStyle()DoublegetDefaultTabSize()TextParagraph.FontAligngetFontAlign()DoublegetIndent()intgetIndentLevel()DoublegetLeftMargin()DoublegetLineSpacing()XSLFTextShapegetParentShape()DoublegetRightMargin()DoublegetSpaceAfter()DoublegetSpaceBefore()doublegetTabStop(int idx)List<XSLFTabStop>getTabStops()StringgetText()TextParagraph.TextAligngetTextAlign()List<XSLFTextRun>getTextRuns()org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphgetXmlObject()booleanisBullet()Returns whether this paragraph has bulletsbooleanisHeaderOrFooter()Iterator<XSLFTextRun>iterator()protected XSLFTextRunnewTextRun(XmlObject r)Helper method to allow subclasses to provide their own text runprotected XSLFTextRunnewTextRun(org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak r)booleanremoveTextRun(XSLFTextRun textRun)Remove a text runvoidsetBullet(boolean flag)voidsetBulletAutoNumber(AutoNumberingScheme scheme, int startAt)Specifies that automatic numbered bullet points should be applied to this paragraphvoidsetBulletCharacter(String str)voidsetBulletFont(String typeface)voidsetBulletFontColor(Color color)voidsetBulletFontColor(PaintStyle color)Set the color to be used on bullet characters within a given paragraph.voidsetBulletFontSize(double bulletSize)Sets the bullet size that is to be used within a paragraph.voidsetBulletStyle(Object... styles)voidsetFontAlign(TextParagraph.FontAlign align)Specifies the font alignment that is to be applied to the paragraph.voidsetIndent(Double indent)voidsetIndentLevel(int level)voidsetLeftMargin(Double leftMargin)voidsetLineSpacing(Double lineSpacing)voidsetRightMargin(Double rightMargin)voidsetSpaceAfter(Double spaceAfter)voidsetSpaceBefore(Double spaceBefore)voidsetTextAlign(TextParagraph.TextAlign align)StringtoString()-
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 String getText()
-
getXmlObject
@Internal public org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph getXmlObject()
-
getParentShape
public XSLFTextShape getParentShape()
- Specified by:
getParentShapein interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getTextRuns
public List<XSLFTextRun> getTextRuns()
- Specified by:
getTextRunsin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
iterator
public Iterator<XSLFTextRun> iterator()
- Specified by:
iteratorin interfaceIterable<XSLFTextRun>
-
addNewTextRun
public XSLFTextRun addNewTextRun()
Add a new run of text- Returns:
- a new run of text
-
removeTextRun
public boolean removeTextRun(XSLFTextRun textRun)
Remove a text run- Parameters:
textRun- a run of text- Returns:
- whether the run was removed
- Since:
- POI 5.2.2
-
addLineBreak
public XSLFTextRun addLineBreak()
Insert a line break- Returns:
- text run representing this line break ('\n')
-
getTextAlign
public TextParagraph.TextAlign getTextAlign()
- Specified by:
getTextAlignin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
setTextAlign
public void setTextAlign(TextParagraph.TextAlign align)
- Specified by:
setTextAlignin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getFontAlign
public TextParagraph.FontAlign getFontAlign()
- Specified by:
getFontAlignin interfaceTextParagraph<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. seeTextParagraph.FontAlign.- Parameters:
align- font align
-
getBulletFont
public String getBulletFont()
- Returns:
- the font to be used on bullet characters within a given paragraph
-
setBulletFont
public void setBulletFont(String typeface)
-
getBulletCharacter
public String getBulletCharacter()
- Returns:
- the character to be used in place of the standard bullet point
-
setBulletCharacter
public void setBulletCharacter(String str)
-
getBulletFontColor
public PaintStyle getBulletFontColor()
- Returns:
- the color of bullet characters within a given paragraph.
A
nullvalue means to use the text font color.
-
setBulletFontColor
public void setBulletFontColor(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 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 Integer getAutoNumberingStartAt()
- Returns:
- the auto numbering starting number, or null if not defined
-
setIndent
public void setIndent(Double indent)
- Specified by:
setIndentin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getIndent
public Double getIndent()
- Specified by:
getIndentin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
setLeftMargin
public void setLeftMargin(Double leftMargin)
- Specified by:
setLeftMarginin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getLeftMargin
public Double getLeftMargin()
- Specified by:
getLeftMarginin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>- Returns:
- the left margin (in points) of the paragraph, null if unset
-
setRightMargin
public void setRightMargin(Double rightMargin)
- Specified by:
setRightMarginin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getRightMargin
public Double getRightMargin()
- Specified by:
getRightMarginin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>- Returns:
- the right margin of the paragraph, null if unset
-
getDefaultTabSize
public Double getDefaultTabSize()
- Specified by:
getDefaultTabSizein interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getTabStop
public double getTabStop(int idx)
-
addTabStop
public void addTabStop(double value)
-
setLineSpacing
public void setLineSpacing(Double lineSpacing)
- Specified by:
setLineSpacingin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getLineSpacing
public Double getLineSpacing()
- Specified by:
getLineSpacingin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
setSpaceBefore
public void setSpaceBefore(Double spaceBefore)
- Specified by:
setSpaceBeforein interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getSpaceBefore
public Double getSpaceBefore()
- Specified by:
getSpaceBeforein interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
setSpaceAfter
public void setSpaceAfter(Double spaceAfter)
- Specified by:
setSpaceAfterin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getSpaceAfter
public Double getSpaceAfter()
- Specified by:
getSpaceAfterin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
setIndentLevel
public void setIndentLevel(int level)
- Specified by:
setIndentLevelin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getIndentLevel
public int getIndentLevel()
- Specified by:
getIndentLevelin interfaceTextParagraph<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-numberingstartAt- the number that will start number for a given sequence of automatically numbered bullets (1-based).
-
getDefaultMasterStyle
@Internal public org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties getDefaultMasterStyle()
- Returns:
- master style text paragraph properties, or
nullif there are no master slides or the master slides do not contain a text paragraph
-
getDefaultFontSize
public Double getDefaultFontSize()
- Specified by:
getDefaultFontSizein interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getDefaultFontFamily
public String getDefaultFontFamily()
- Specified by:
getDefaultFontFamilyin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getBulletStyle
public TextParagraph.BulletStyle getBulletStyle()
- Specified by:
getBulletStylein interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
setBulletStyle
public void setBulletStyle(Object... styles)
- Specified by:
setBulletStylein interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
getTabStops
public List<XSLFTabStop> getTabStops()
- Specified by:
getTabStopsin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
addTabStops
public void addTabStops(double positionInPoints, TabStop.TabStopType tabStopType)- Specified by:
addTabStopsin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
clearTabStops
public void clearTabStops()
- Specified by:
clearTabStopsin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
isHeaderOrFooter
public boolean isHeaderOrFooter()
- Specified by:
isHeaderOrFooterin interfaceTextParagraph<XSLFShape,XSLFTextParagraph,XSLFTextRun>
-
newTextRun
protected XSLFTextRun newTextRun(XmlObject 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
-
newTextRun
protected XSLFTextRun newTextRun(org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak r)
-
-