Class XSLFTextParagraph
- All Implemented Interfaces:
Iterable<XSLFTextRun>
,TextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun>
- 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
Modifier and TypeMethodDescriptionInsert a line breakAdd a new run of textvoid
addTabStop
(double value) void
addTabStops
(double positionInPoints, TabStop.TabStopType tabStopType) Set theTabStop
collectionvoid
Removes the tabstops of this paragraphs.Returns the bullet size that is to be used within a paragraph.Returns the font alignment that is applied to the paragraph.int
Returns the vertical line spacing that is to be used within a paragraph.Specifies the right margin of the paragraph.The amount of vertical white space after the paragraph This may be specified in two different ways, percentage spacing and font point spacing: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) Get theTabStops
- the list can't be and it's entries shouldn't be modified.getText()
Returns the alignment that is applied to the paragraph.Fetch the text runs that are contained within this block of textorg.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph
boolean
isBullet()
Returns whether this paragraph has bulletsboolean
Convenience method to determine if this text paragraph is part of the slide header or footeriterator()
protected XSLFTextRun
newTextRun
(org.apache.xmlbeans.XmlObject r) Helper method to allow subclasses to provide their own text runprotected XSLFTextRun
newTextRun
(org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak r) void
setBullet
(boolean flag) void
setBulletAutoNumber
(AutoNumberingScheme scheme, int startAt) Specifies that automatic numbered bullet points should be applied to this paragraphvoid
setBulletCharacter
(String str) void
setBulletFont
(String typeface) void
setBulletFontColor
(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
(Object... styles) Sets the bullet styles.void
Specifies the font alignment that is to be applied to the paragraph.void
Specifies the indent size that will be applied to the first line of text in the paragraph.void
setIndentLevel
(int level) Specifies the particular level text properties that this paragraph will follow.void
setLeftMargin
(Double leftMargin) Specifies the left margin of the paragraph.void
setLineSpacing
(Double lineSpacing) This element specifies the vertical line spacing that is to be used within a paragraph.void
setRightMargin
(Double rightMargin) 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
Specifies the alignment that is to be applied to the paragraph.toString()
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 Details
-
getText
-
getXmlObject
-
getParentShape
- Specified by:
getParentShape
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun>
-
getTextRuns
Description copied from interface:TextParagraph
Fetch the text runs that are contained within this block of text- Specified by:
getTextRuns
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun>
-
iterator
- Specified by:
iterator
in interfaceIterable<XSLFTextRun>
-
addNewTextRun
Add a new run of text- Returns:
- a new run of text
-
addLineBreak
Insert a line break- Returns:
- text run representing this line break ('\n')
-
getTextAlign
Description copied from interface:TextParagraph
Returns the alignment that is applied to the paragraph. If this attribute is omitted, then null is returned. User code can imply the valueTextParagraph.TextAlign.LEFT
then.- Specified by:
getTextAlign
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- alignment that is applied to the paragraph
-
setTextAlign
Description copied from interface:TextParagraph
Specifies the alignment that is to be applied to the paragraph. Possible values for this include left, right, centered, justified and distributed, seeTextParagraph.TextAlign
.- Specified by:
setTextAlign
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
align
- text align
-
getFontAlign
Description copied from interface:TextParagraph
Returns the font alignment that is applied to the paragraph. If this attribute is omitted, then null is return, user code can imply the a value ofTextParagraph.FontAlign.AUTO
- Specified by:
getFontAlign
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- alignment that is applied to the paragraph
-
setFontAlign
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
- Returns:
- the font to be used on bullet characters within a given paragraph
-
setBulletFont
-
getBulletCharacter
- Returns:
- the character to be used in place of the standard bullet point
-
setBulletCharacter
-
getBulletFontColor
- Returns:
- the color of bullet characters within a given paragraph.
A
null
value means to use the text font color.
-
setBulletFontColor
-
setBulletFontColor
Set the color to be used on bullet characters within a given paragraph.- Parameters:
color
- the bullet color
-
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 invalid input: '<' 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 invalid input: '<' 0, then it specifies the size in points
-
getAutoNumberingScheme
- Returns:
- the auto numbering scheme, or null if not defined
-
getAutoNumberingStartAt
- Returns:
- the auto numbering starting number, or null if not defined
-
setIndent
Description copied from interface:TextParagraph
Specifies the indent size that will be applied to the first line of text in the paragraph.- Specified by:
setIndent
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
indent
- the indent (in points) applied to the first line of text in the paragraph
-
getIndent
- Specified by:
getIndent
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the indent (in points) applied to the first line of text in the paragraph. or null, if unset
-
setLeftMargin
Description copied from interface:TextParagraph
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.- Specified by:
setLeftMargin
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
leftMargin
- the left margin (in points) or null to unset
-
getLeftMargin
- Specified by:
getLeftMargin
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the left margin (in points) of the paragraph, null if unset
-
setRightMargin
- Specified by:
setRightMargin
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
rightMargin
- the right margin (in points) of the paragraph
-
getRightMargin
Description copied from interface:TextParagraph
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. The right margin is not support and therefore ignored by the HSLF implementation.- Specified by:
getRightMargin
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the right margin of the paragraph, null if unset
-
getDefaultTabSize
- Specified by:
getDefaultTabSize
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the default size for a tab character within this paragraph in points, null if unset
-
getTabStop
public double getTabStop(int idx) -
addTabStop
public void addTabStop(double value) -
setLineSpacing
Description copied from interface:TextParagraph
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 invalid input: '<' 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);
- Specified by:
setLineSpacing
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
lineSpacing
- the vertical line spacing
-
getLineSpacing
Description copied from interface:TextParagraph
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 invalid input: '<' 0, the absolute value of linespacing is the spacing in points
- Specified by:
getLineSpacing
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the vertical line spacing or null, if unset
-
setSpaceBefore
Description copied from interface:TextParagraph
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 invalid input: '<' 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);
- Specified by:
setSpaceBefore
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
spaceBefore
- the vertical white space before the paragraph, null to unset
-
getSpaceBefore
Description copied from interface:TextParagraph
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 invalid input: '<' 0, the absolute value in points
- Specified by:
getSpaceBefore
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the vertical white space before the paragraph, or null if unset
-
setSpaceAfter
Description copied from interface:TextParagraph
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 invalid input: '<' 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);
- Specified by:
setSpaceAfter
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
spaceAfter
- the vertical white space after the paragraph, null to unset
-
getSpaceAfter
Description copied from interface:TextParagraph
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 invalid input: '<' 0, the absolute value of linespacing is the spacing in points
- Specified by:
getSpaceAfter
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the vertical white space after the paragraph or null, if unset
-
setIndentLevel
public void setIndentLevel(int level) Description copied from interface:TextParagraph
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.- Specified by:
setIndentLevel
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
level
- the level (0 ... 4)
-
getIndentLevel
public int getIndentLevel()- Specified by:
getIndentLevel
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - 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
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).
-
toString
-
getDefaultFontSize
- Specified by:
getDefaultFontSize
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the default font size, in case its not set in the textrun or null, if unset
-
getDefaultFontFamily
- Specified by:
getDefaultFontFamily
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun>
-
getBulletStyle
- Specified by:
getBulletStyle
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the bullet style of the paragraph, if
null
then no bullets are used
-
setBulletStyle
Description copied from interface:TextParagraph
Sets the bullet styles. If no styles are given, the bullets are omitted. Possible attributes are integer/double (bullet size), Color (bullet color), character (bullet character), string (bullet font), AutoNumberingScheme- Specified by:
setBulletStyle
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Parameters:
styles
-
-
getTabStops
Description copied from interface:TextParagraph
Get theTabStops
- the list can't be and it's entries shouldn't be modified. Opposed to other properties, this method is not cascading to the master sheet, if the property is not defined on the normal slide level, i.e. the tabstops on different levels aren't merged.- Specified by:
getTabStops
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun> - Returns:
- the tabstop collection or
null
if no tabstops are defined
-
addTabStops
Description copied from interface:TextParagraph
Set theTabStop
collection- Specified by:
addTabStops
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun>
-
clearTabStops
public void clearTabStops()Description copied from interface:TextParagraph
Removes the tabstops of this paragraphs. This doesn't affect inherited tabstops, e.g. inherited by the slide master- Specified by:
clearTabStops
in interfaceTextParagraph<XSLFShape,
XSLFTextParagraph, XSLFTextRun>
-
newTextRun
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
-