@Beta public class XSLFTextParagraph extends Object implements Iterable<XSLFTextRun>
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(Graphics2D graphics,
double x,
double y) |
String |
getBulletCharacter() |
String |
getBulletFont() |
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) |
String |
getText() |
TextAlign |
getTextAlign()
Returns the alignment that is applied to the paragraph.
|
List<XSLFTextRun> |
getTextRuns() |
org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph |
getXmlObject() |
boolean |
isBullet()
Returns whether this paragraph has bullets
|
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(String str) |
void |
setBulletFont(String typeface) |
void |
setBulletFontColor(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.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public String getText()
@Internal public org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph getXmlObject()
public List<XSLFTextRun> getTextRuns()
public Iterator<XSLFTextRun> iterator()
iterator
in interface Iterable<XSLFTextRun>
public XSLFTextRun addNewTextRun()
public XSLFTextRun addLineBreak()
public TextAlign getTextAlign()
public void setTextAlign(TextAlign align)
TextAlign
.align
- text alignpublic String getBulletFont()
public void setBulletFont(String typeface)
public String getBulletCharacter()
public void setBulletCharacter(String str)
public Color getBulletFontColor()
null
value means to use the text font color.public void setBulletFontColor(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.public double getIndent()
public void setLeftMargin(double value)
value
- the left margin of the paragraphpublic double getLeftMargin()
public double getDefaultTabSize()
public double getTabStop(int idx)
public void addTabStop(double value)
public 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)
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 setBulletAutoNumber(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 double draw(Graphics2D graphics, double x, double y)
Copyright © 2020. All rights reserved.