public class XWPFParagraph extends Object implements IBodyElement
Modifier and Type | Field and Description |
---|---|
protected XWPFDocument |
document
For access to the document's hyperlink, comments, tables etc
|
protected IBody |
part |
protected List<XWPFRun> |
runs |
Constructor and Description |
---|
XWPFParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP prgrph,
IBody part) |
Modifier and Type | Method and Description |
---|---|
protected void |
addRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR run)
add a new run at the end of the position of
the content of parameter run
|
void |
addRun(XWPFRun r)
adds a new Run to the Paragraph
|
XWPFRun |
createRun()
Appends a new run to this paragraph
|
ParagraphAlignment |
getAlignment()
Returns the paragraph alignment which shall be applied to text in this
paragraph.
|
IBody |
getBody() |
Borders |
getBorderBetween()
Specifies the border which shall be displayed between each paragraph in a
set of paragraphs which have the same set of paragraph border settings.
|
Borders |
getBorderBottom()
Specifies the border which shall be displayed below a set of
paragraphs which have the same set of paragraph border settings.
|
Borders |
getBorderLeft()
Specifies the border which shall be displayed on the left side of the
page around the specified paragraph.
|
Borders |
getBorderRight()
Specifies the border which shall be displayed on the right side of the
page around the specified paragraph.
|
Borders |
getBorderTop()
Specifies the border which shall be displayed above a set of paragraphs
which have the same set of paragraph border settings.
|
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP |
getCTP() |
XWPFDocument |
getDocument() |
BodyElementType |
getElementType()
returns the type of the BodyElement Paragraph
|
String |
getFootnoteText()
Returns the footnote text of the paragraph
|
int |
getIndentationFirstLine()
Specifies the additional indentation which shall be applied to the first
line of the parent paragraph.
|
int |
getIndentationHanging()
Specifies the indentation which shall be removed from the first line of
the parent paragraph, by moving the indentation on the first line back
towards the beginning of the direction of text flow.
|
int |
getIndentationLeft()
Specifies the indentation which shall be placed between the left text
margin for this paragraph and the left edge of that paragraph's content
in a left to right paragraph, and the right text margin and the right
edge of that paragraph's text in a right to left paragraph
If this attribute is omitted, its value shall be assumed to be zero.
|
int |
getIndentationRight()
Specifies the indentation which shall be placed between the right text
margin for this paragraph and the right edge of that paragraph's content
in a left to right paragraph, and the right text margin and the right
edge of that paragraph's text in a right to left paragraph
If this attribute is omitted, its value shall be assumed to be zero.
|
BigInteger |
getNumID()
If style exist for this paragraph
NumId of the paragraph will be returned.
|
String |
getParagraphText()
Returns the text of the paragraph, but not of any objects in the
paragraph
|
POIXMLDocumentPart |
getPart()
returns the part of the bodyElement
|
BodyType |
getPartType()
returns the partType of the bodyPart which owns the bodyElement
|
String |
getPictureText()
Returns any text from any suitable pictures in the paragraph
|
XWPFRun |
getRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR r)
return the XWPFRun-Element which owns the CTR run-Element
|
List<XWPFRun> |
getRuns() |
int |
getSpacingAfter()
Specifies the spacing that should be added after the last line in this
paragraph in the document in absolute units.
|
int |
getSpacingAfterLines()
Specifies the spacing that should be added after the last line in this
paragraph in the document in absolute units.
|
int |
getSpacingBefore()
Specifies the spacing that should be added above the first line in this
paragraph in the document in absolute units.
|
int |
getSpacingBeforeLines()
Specifies the spacing that should be added before the first line in this paragraph in the
document in line units.
|
LineSpacingRule |
getSpacingLineRule()
Specifies how the spacing between lines is calculated as stored in the
line attribute.
|
String |
getStyle() |
String |
getStyleID()
Return styleID of the paragraph if style exist for this paragraph
if not, null will be returned
|
String |
getText()
Return the textual content of the paragraph, including text from pictures
in it.
|
String |
getText(TextSegement segment)
get a Text
|
TextAlignment |
getVerticalAlignment()
Returns the text vertical alignment which shall be applied to text in
this paragraph.
|
XWPFRun |
insertNewRun(int pos)
insert a new Run in RunArray
|
boolean |
isEmpty() |
boolean |
isPageBreak()
Specifies that when rendering this document in a paginated
view, the contents of this paragraph are rendered on the start of a new
page in the document.
|
boolean |
isWordWrap()
This element specifies whether a consumer shall break Latin text which
exceeds the text extents of a line by breaking the word across two lines
(breaking on the character level) or by moving the word to the following
line (breaking on the word level).
|
boolean |
removeRun(int pos)
removes a Run at the position pos in the paragraph
|
TextSegement |
searchText(String searched,
PositionInParagraph startPos)
this methods parse the paragraph and search for the string searched.
|
void |
setAlignment(ParagraphAlignment align)
Specifies the paragraph alignment which shall be applied to text in this
paragraph.
|
void |
setBorderBetween(Borders border)
Specifies the border which shall be displayed between each paragraph in a
set of paragraphs which have the same set of paragraph border settings.
|
void |
setBorderBottom(Borders border)
Specifies the border which shall be displayed below a set of paragraphs
which have the same set of paragraph border settings.
|
void |
setBorderLeft(Borders border)
Specifies the border which shall be displayed on the left side of the
page around the specified paragraph.
|
void |
setBorderRight(Borders border)
Specifies the border which shall be displayed on the right side of the
page around the specified paragraph.
|
void |
setBorderTop(Borders border)
Specifies the border which shall be displayed above a set of paragraphs
which have the same set of paragraph border settings.
|
void |
setIndentationFirstLine(int indentation)
Specifies the additional indentation which shall be applied to the first
line of the parent paragraph.
|
void |
setIndentationHanging(int indentation)
Specifies the indentation which shall be removed from the first line of
the parent paragraph, by moving the indentation on the first line back
towards the beginning of the direction of text flow.
|
void |
setIndentationLeft(int indentation)
Specifies the indentation which shall be placed between the left text
margin for this paragraph and the left edge of that paragraph's content
in a left to right paragraph, and the right text margin and the right
edge of that paragraph's text in a right to left paragraph
If this attribute is omitted, its value shall be assumed to be zero.
|
void |
setIndentationRight(int indentation)
Specifies the indentation which shall be placed between the right text
margin for this paragraph and the right edge of that paragraph's content
in a left to right paragraph, and the right text margin and the right
edge of that paragraph's text in a right to left paragraph
If this attribute is omitted, its value shall be assumed to be zero.
|
void |
setNumID(BigInteger numPos)
setNumID of Paragraph
|
void |
setPageBreak(boolean pageBreak)
Specifies that when rendering this document in a paginated
view, the contents of this paragraph are rendered on the start of a new
page in the document.
|
void |
setSpacingAfter(int spaces)
Specifies the spacing that should be added after the last line in this
paragraph in the document in absolute units.
|
void |
setSpacingAfterLines(int spaces)
Specifies the spacing that should be added after the last line in this
paragraph in the document in line units.
|
void |
setSpacingBefore(int spaces)
Specifies the spacing that should be added above the first line in this
paragraph in the document in absolute units.
|
void |
setSpacingBeforeLines(int spaces)
Specifies the spacing that should be added before the first line in this
paragraph in the document in line units.
|
void |
setSpacingLineRule(LineSpacingRule rule)
Specifies how the spacing between lines is calculated as stored in the
line attribute.
|
void |
setStyle(String newStyle)
This method provides a style to the paragraph
This is useful when, e.g.
|
void |
setVerticalAlignment(TextAlignment valign)
Specifies the text vertical alignment which shall be applied to text in
this paragraph.
|
void |
setWordWrap(boolean wrap)
This element specifies whether a consumer shall break Latin text which
exceeds the text extents of a line by breaking the word across two lines
(breaking on the character level) or by moving the word to the following
line (breaking on the word level).
|
protected IBody part
protected XWPFDocument document
public XWPFParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP prgrph, IBody part)
@Internal public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP getCTP()
public boolean isEmpty()
public XWPFDocument getDocument()
public String getText()
public String getStyleID()
public BigInteger getNumID()
public void setNumID(BigInteger numPos)
numPos
- public String getParagraphText()
public String getPictureText()
public String getFootnoteText()
public XWPFRun createRun()
public ParagraphAlignment getAlignment()
public void setAlignment(ParagraphAlignment align)
align
- the paragraph alignment to apply to this paragraph.public TextAlignment getVerticalAlignment()
public void setVerticalAlignment(TextAlignment valign)
valign
- the paragraph vertical alignment to apply to this
paragraph.public void setBorderTop(Borders border)
border
- for a list of all types of borders
public Borders getBorderTop()
setBorderTop(Borders)
,
a list of all types of borders
public void setBorderBottom(Borders border)
border
- a list of all types of borders
public Borders getBorderBottom()
setBorderBottom(Borders)
,
a list of all types of borders
public void setBorderLeft(Borders border)
border
- for a list of all possible borders
public Borders getBorderLeft()
setBorderLeft(Borders)
,
for a list of all possible borders
public void setBorderRight(Borders border)
border
- for a list of all possible borders
public Borders getBorderRight()
setBorderRight(Borders)
,
for a list of all possible borders
public void setBorderBetween(Borders border)
border
- for a list of all possible borders
public Borders getBorderBetween()
setBorderBetween(Borders)
,
for a list of all possible borders
public void setPageBreak(boolean pageBreak)
pageBreak
- -
boolean valuepublic boolean isPageBreak()
public void setSpacingAfter(int spaces)
spaces
- -
a positive whole number, whose contents consist of a
measurement in twentieths of a point.public int getSpacingAfter()
public void setSpacingAfterLines(int spaces)
spaces
- -
a positive whole number, whose contents consist of a
measurement in twentieths of apublic int getSpacingAfterLines()
setSpacingAfterLines(int)
public void setSpacingBefore(int spaces)
spaces
- public int getSpacingBefore()
setSpacingBefore(int)
public void setSpacingBeforeLines(int spaces)
spaces
- public int getSpacingBeforeLines()
setSpacingBeforeLines(int)
public void setSpacingLineRule(LineSpacingRule rule)
rule
- LineSpacingRule
public LineSpacingRule getSpacingLineRule()
LineSpacingRule
,
setSpacingLineRule(LineSpacingRule)
public void setIndentationLeft(int indentation)
indentation
- public int getIndentationLeft()
public void setIndentationRight(int indentation)
indentation
- public int getIndentationRight()
public void setIndentationHanging(int indentation)
indentation
- public int getIndentationHanging()
public void setIndentationFirstLine(int indentation)
indentation
- public int getIndentationFirstLine()
public void setWordWrap(boolean wrap)
wrap
- - booleanpublic boolean isWordWrap()
public void setStyle(String newStyle)
newStyle
- public String getStyle()
protected void addRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR run)
run
- public TextSegement searchText(String searched, PositionInParagraph startPos)
searched
- startPos
- public XWPFRun insertNewRun(int pos)
pos
- public String getText(TextSegement segment)
segment
- public boolean removeRun(int pos)
pos
- public BodyElementType getElementType()
getElementType
in interface IBodyElement
IBodyElement.getElementType()
public IBody getBody()
getBody
in interface IBodyElement
public POIXMLDocumentPart getPart()
getPart
in interface IBodyElement
IBody.getPart()
public BodyType getPartType()
getPartType
in interface IBodyElement
IBody.getPartType()
public void addRun(XWPFRun r)
r
- public XWPFRun getRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR r)
r
- Copyright © 2020. All rights reserved.