public class XSSFTextParagraph extends java.lang.Object implements java.lang.Iterable<XSSFTextRun>
Modifier and Type | Method and Description |
---|---|
XSSFTextRun |
addLineBreak()
Insert a line break
|
XSSFTextRun |
addNewTextRun()
Add a new run of text
|
void |
addTabStop(double value)
Add a single tab stop to be used on a line of text when there are one or more tab characters
present within the text.
|
ListAutoNumber |
getBulletAutoNumberScheme()
Returns the auto number scheme if this paragraph has automatic numbered bullets, otherwise returns ListAutoNumber.ARABIC_PLAIN
|
int |
getBulletAutoNumberStart()
Returns the starting number if this paragraph has automatic numbered bullets, otherwise returns 0
|
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()
Returns the level of text properties that this paragraph will follow.
|
double |
getLineSpacing()
Returns the vertical line spacing that is to be used within a paragraph.
|
org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape |
getParentShape() |
double |
getRightMargin() |
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.
|
TextFontAlign |
getTextFontAlign()
Returns where vertically on a line of text the actual words are positioned.
|
java.util.List<XSSFTextRun> |
getTextRuns() |
org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph |
getXmlObject() |
boolean |
isBullet()
Returns whether this paragraph has bullets
|
boolean |
isBulletAutoNumber()
Returns whether this paragraph has automatic numbered bullets
|
java.util.Iterator<XSSFTextRun> |
iterator() |
void |
setBullet(boolean flag)
Set or unset this paragraph as a bullet point
|
void |
setBullet(ListAutoNumber scheme)
Set this paragraph as an automatic numbered bullet point
|
void |
setBullet(ListAutoNumber scheme,
int startAt)
Set this paragraph as an automatic numbered bullet point
|
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 |
setRightMargin(double value)
Specifies the right margin of the 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.
|
void |
setTextFontAlign(TextFontAlign align)
Determines where vertically on a line of text the actual words are positioned.
|
java.lang.String |
toString() |
public java.lang.String getText()
@Internal public org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph getXmlObject()
@Internal public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape getParentShape()
public java.util.List<XSSFTextRun> getTextRuns()
public java.util.Iterator<XSSFTextRun> iterator()
iterator
in interface java.lang.Iterable<XSSFTextRun>
public XSSFTextRun addNewTextRun()
public XSSFTextRun addLineBreak()
public TextAlign getTextAlign()
public void setTextAlign(TextAlign align)
TextAlign
.align
- text alignpublic TextFontAlign getTextFontAlign()
public void setTextFontAlign(TextFontAlign align)
align
- text font alignpublic java.lang.String getBulletFont()
public void setBulletFont(java.lang.String typeface)
public java.lang.String getBulletCharacter()
public void setBulletCharacter(java.lang.String str)
public java.awt.Color getBulletFontColor()
null
value means to use the text font color.public void setBulletFontColor(java.awt.Color color)
color
- the bullet colorpublic double getBulletFontSize()
If bulletSize >= 0, then bulletSize is a percentage of the font size. If bulletSize < 0, then it specifies the size in points
public void setBulletFontSize(double bulletSize)
If bulletSize >= 0, then bulletSize is a percentage of the font size. If bulletSize < 0, then it specifies the size in points
public void setIndent(double value)
value
- the indent in points, -1 to unset indent and use the default of 0.public double getIndent()
public void setLeftMargin(double value)
value
- the left margin of the paragraph, -1 to clear the margin and use the default of 0.public double getLeftMargin()
public void setRightMargin(double value)
value
- the right margin of the paragraph, -1 to clear the margin and use the default of 0.public double getRightMargin()
public double getDefaultTabSize()
public double getTabStop(int idx)
public void addTabStop(double value)
value
- the position of the tab stop relative to the left marginpublic void setLineSpacing(double linespacing)
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);
linespacing
- the vertical line spacingpublic double getLineSpacing()
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
public void setSpaceBefore(double spaceBefore)
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);
spaceBefore
- the vertical white space before the paragraph.public double getSpaceBefore()
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
public void setSpaceAfter(double spaceAfter)
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);
spaceAfter
- the vertical white space after the paragraph.public double getSpaceAfter()
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
public void setLevel(int level)
Note that the closest properties object to the text is used, therefore if there is a conflict between the text paragraph properties and the list style properties for this level then the text paragraph properties will take precedence.
level
- the level (0 ... 4)public int getLevel()
public boolean isBullet()
public void setBullet(boolean flag)
flag
- whether text in this paragraph has bulletspublic void setBullet(ListAutoNumber scheme, int startAt)
scheme
- type of auto-numberingstartAt
- the number that will start number for a given sequence of automatically
numbered bullets (1-based).public void setBullet(ListAutoNumber scheme)
scheme
- type of auto-numberingpublic boolean isBulletAutoNumber()
public int getBulletAutoNumberStart()
public ListAutoNumber getBulletAutoNumberScheme()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2018 The Apache Software Foundation or its licensors, as applicable.