Class XWPFParagraph
- java.lang.Object
-
- org.apache.poi.xwpf.usermodel.XWPFParagraph
-
- All Implemented Interfaces:
Paragraph
,IBodyElement
,IRunBody
,ISDTContents
public class XWPFParagraph extends java.lang.Object implements IBodyElement, IRunBody, ISDTContents, Paragraph
A Paragraph within a Document, Table, Header etc.
A paragraph has a lot of styling information, but the actual text (possibly along with more styling) is held on the child
XWPFRun
s.
-
-
Constructor Summary
Constructors Constructor Description XWPFParagraph(CTP prgrph, IBody part)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addFootnoteReference(XWPFAbstractFootnoteEndnote footnote)
Add a new run with a reference to the specified footnote.void
addRun(XWPFRun r)
adds a new Run to the ParagraphXWPFRun
createRun()
Appends a new run to this paragraphParagraphAlignment
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.CTP
getCTP()
XWPFDocument
getDocument()
BodyElementType
getElementType()
returns the type of the BodyElement Paragraphint
getFirstLineIndent()
int
getFontAlignment()
java.lang.String
getFootnoteText()
Returns the footnote text of the paragraphint
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 paragraphint
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 paragraphint
getIndentFromLeft()
int
getIndentFromRight()
java.util.List<IRunElement>
getIRuns()
Return literal runs and sdt/content control objects.java.lang.String
getNumFmt()
Returns numbering format for this paragraph, eg bullet or lowerLetter.java.math.BigInteger
getNumID()
If style exist for this paragraph NumId of the paragraph will be returned.java.math.BigInteger
getNumIlvl()
Returns Ilvl of the numeric style for this paragraph.java.lang.String
getNumLevelText()
Returns the text that should be used around the paragraph level numbers.java.math.BigInteger
getNumStartOverride()
Gets the numstartOverride for the paragraph numbering for this paragraph.java.lang.String
getParagraphText()
Returns the text of the paragraph, but not of any objects in the paragraphPOIXMLDocumentPart
getPart()
returns the part of the bodyElementBodyType
getPartType()
returns the partType of the bodyPart which owns the bodyElementjava.lang.String
getPictureText()
Returns any text from any suitable pictures in the paragraphXWPFRun
getRun(CTR r)
return the XWPFRun-Element which owns the CTR run-Elementjava.util.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.double
getSpacingBetween()
Return the spacing between lines of a paragraph.LineSpacingRule
getSpacingLineRule()
Specifies how the spacing between lines is calculated as stored in the line attribute.java.lang.String
getStyle()
java.lang.String
getStyleID()
Return styleID of the paragraph if style exist for this paragraph if not, null will be returnedjava.lang.String
getText()
Return the textual content of the paragraph, including text from pictures and sdt elements in it.java.lang.String
getText(TextSegment segment)
get a TextTextAlignment
getVerticalAlignment()
Returns the text vertical alignment which shall be applied to text in this paragraph.XWPFRun
insertNewRun(int pos)
insert a new Run in RunArrayboolean
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()
boolean
isWordWrapped()
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 paragraphTextSegment
searchText(java.lang.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
setFirstLineIndent(int first)
void
setFontAlignment(int align)
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 paragraphvoid
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 paragraphvoid
setIndentFromLeft(int dxaLeft)
void
setIndentFromRight(int dxaRight)
void
setNumID(java.math.BigInteger numPos)
setNumID of Paragraphvoid
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
setSpacingBetween(double spacing)
Sets the spacing between lines in a paragraphvoid
setSpacingBetween(double spacing, LineSpacingRule rule)
Sets the spacing between lines in a paragraphvoid
setSpacingLineRule(LineSpacingRule rule)
Specifies how the spacing between lines is calculated as stored in the line attribute.void
setStyle(java.lang.String styleId)
Set the style ID for the paragraphvoid
setVerticalAlignment(TextAlignment valign)
Specifies the text vertical alignment which shall be applied to text in this paragraph.void
setWordWrap(boolean wrap)
Deprecated.void
setWordWrapped(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).
-
-
-
Method Detail
-
getRuns
public java.util.List<XWPFRun> getRuns()
-
getIRuns
public java.util.List<IRunElement> getIRuns()
Return literal runs and sdt/content control objects.- Returns:
- List
-
isEmpty
public boolean isEmpty()
-
getDocument
public XWPFDocument getDocument()
- Specified by:
getDocument
in interfaceIRunBody
-
getText
public java.lang.String getText()
Return the textual content of the paragraph, including text from pictures and sdt elements in it.
-
getStyleID
public java.lang.String getStyleID()
Return styleID of the paragraph if style exist for this paragraph if not, null will be returned- Returns:
- styleID as String
-
getNumID
public java.math.BigInteger getNumID()
If style exist for this paragraph NumId of the paragraph will be returned. If style not exist null will be returned- Returns:
- NumID as BigInteger
-
setNumID
public void setNumID(java.math.BigInteger numPos)
setNumID of Paragraph- Parameters:
numPos
-
-
getNumIlvl
public java.math.BigInteger getNumIlvl()
Returns Ilvl of the numeric style for this paragraph. Returns null if this paragraph does not have numeric style.- Returns:
- Ilvl as BigInteger
-
getNumFmt
public java.lang.String getNumFmt()
Returns numbering format for this paragraph, eg bullet or lowerLetter. Returns null if this paragraph does not have numeric style.
-
getNumLevelText
public java.lang.String getNumLevelText()
Returns the text that should be used around the paragraph level numbers.- Returns:
- a string (e.g. "%1.") or null if the value is not found.
-
getNumStartOverride
public java.math.BigInteger getNumStartOverride()
Gets the numstartOverride for the paragraph numbering for this paragraph.- Returns:
- returns the overridden start number or null if there is no override for this paragraph.
-
getParagraphText
public java.lang.String getParagraphText()
Returns the text of the paragraph, but not of any objects in the paragraph
-
getPictureText
public java.lang.String getPictureText()
Returns any text from any suitable pictures in the paragraph
-
getFootnoteText
public java.lang.String getFootnoteText()
Returns the footnote text of the paragraph- Returns:
- the footnote text or empty string if the paragraph does not have footnotes
-
getAlignment
public ParagraphAlignment getAlignment()
Returns the paragraph alignment which shall be applied to text in this paragraph.If this element is not set on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no alignment is applied to the paragraph.
- Returns:
- the paragraph alignment of this paragraph.
-
setAlignment
public void setAlignment(ParagraphAlignment align)
Specifies the paragraph alignment which shall be applied to text in this paragraph.If this element is not set on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no alignment is applied to the paragraph.
- Parameters:
align
- the paragraph alignment to apply to this paragraph.
-
getFontAlignment
public int getFontAlignment()
- Specified by:
getFontAlignment
in interfaceParagraph
- Returns:
- The raw alignment value,
getAlignment()
is suggested
-
setFontAlignment
public void setFontAlignment(int align)
- Specified by:
setFontAlignment
in interfaceParagraph
-
getVerticalAlignment
public TextAlignment getVerticalAlignment()
Returns the text vertical alignment which shall be applied to text in this paragraph.If the line height (before any added spacing) is larger than one or more characters on the line, all characters will be aligned to each other as specified by this element.
If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then the vertical alignment of all characters on the line shall be automatically determined by the consumer.
- Returns:
- the vertical alignment of this paragraph.
-
setVerticalAlignment
public void setVerticalAlignment(TextAlignment valign)
Specifies the text vertical alignment which shall be applied to text in this paragraph.If the line height (before any added spacing) is larger than one or more characters on the line, all characters will be aligned to each other as specified by this element.
If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then the vertical alignment of all characters on the line shall be automatically determined by the consumer.
- Parameters:
valign
- the paragraph vertical alignment to apply to this paragraph.
-
getBorderTop
public Borders getBorderTop()
Specifies the border which shall be displayed above a set of paragraphs which have the same set of paragraph border settings.- Returns:
- paragraphBorder - the top border for the paragraph
- See Also:
setBorderTop(Borders)
,a list of all types of borders
-
setBorderTop
public 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.To determine if any two adjoining paragraphs shall have an individual top and bottom border or a between border, the set of borders on the two adjoining paragraphs are compared. If the border information on those two paragraphs is identical for all possible paragraphs borders, then the between border is displayed. Otherwise, the final paragraph shall use its bottom border and the following paragraph shall use its top border, respectively. If this border specifies a space attribute, that value determines the space above the text (ignoring any spacing above) which should be left before this border is drawn, specified in points.
If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no between border shall be applied above identical paragraphs.
This border can only be a line border.- Parameters:
border
-- See Also:
for a list of all types of borders
-
getBorderBottom
public Borders getBorderBottom()
Specifies the border which shall be displayed below a set of paragraphs which have the same set of paragraph border settings.- Returns:
- paragraphBorder - the bottom border for the paragraph
- See Also:
setBorderBottom(Borders)
,a list of all types of borders
-
setBorderBottom
public 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.To determine if any two adjoining paragraphs shall have an individual top and bottom border or a between border, the set of borders on the two adjoining paragraphs are compared. If the border information on those two paragraphs is identical for all possible paragraphs borders, then the between border is displayed. Otherwise, the final paragraph shall use its bottom border and the following paragraph shall use its top border, respectively. If this border specifies a space attribute, that value determines the space after the bottom of the text (ignoring any space below) which should be left before this border is drawn, specified in points.
If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no between border shall be applied below identical paragraphs.
This border can only be a line border.- Parameters:
border
-- See Also:
a list of all types of borders
-
getBorderLeft
public Borders getBorderLeft()
Specifies the border which shall be displayed on the left side of the page around the specified paragraph.- Returns:
- ParagraphBorder - the left border for the paragraph
- See Also:
setBorderLeft(Borders)
,for a list of all possible borders
-
setBorderLeft
public void setBorderLeft(Borders border)
Specifies the border which shall be displayed on the left side of the page around the specified paragraph.To determine if any two adjoining paragraphs should have a left border which spans the full line height or not, the left border shall be drawn between the top border or between border at the top (whichever would be rendered for the current paragraph), and the bottom border or between border at the bottom (whichever would be rendered for the current paragraph).
If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no left border shall be applied.
This border can only be a line border.- Parameters:
border
-- See Also:
for a list of all possible borders
-
getBorderRight
public Borders getBorderRight()
Specifies the border which shall be displayed on the right side of the page around the specified paragraph.- Returns:
- ParagraphBorder - the right border for the paragraph
- See Also:
setBorderRight(Borders)
,for a list of all possible borders
-
setBorderRight
public void setBorderRight(Borders border)
Specifies the border which shall be displayed on the right side of the page around the specified paragraph.To determine if any two adjoining paragraphs should have a right border which spans the full line height or not, the right border shall be drawn between the top border or between border at the top (whichever would be rendered for the current paragraph), and the bottom border or between border at the bottom (whichever would be rendered for the current paragraph).
If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no right border shall be applied.
This border can only be a line border.- Parameters:
border
-- See Also:
for a list of all possible borders
-
getBorderBetween
public 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.- Returns:
- ParagraphBorder - the between border for the paragraph
- See Also:
setBorderBetween(Borders)
,for a list of all possible borders
-
setBorderBetween
public 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.To determine if any two adjoining paragraphs should have a between border or an individual top and bottom border, the set of borders on the two adjoining paragraphs are compared. If the border information on those two paragraphs is identical for all possible paragraphs borders, then the between border is displayed. Otherwise, each paragraph shall use its bottom and top border, respectively. If this border specifies a space attribute, that value is ignored - this border is always located at the bottom of each paragraph with an identical following paragraph, taking into account any space after the line pitch.
If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no between border shall be applied between identical paragraphs.
This border can only be a line border.- Parameters:
border
-- See Also:
for a list of all possible borders
-
isPageBreak
public 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.If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then this property shall not be applied. Since the paragraph is specified to start on a new page, it begins page two even though it could have fit on page one.
- Returns:
- boolean - if page break is set
-
setPageBreak
public 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.If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then this property shall not be applied. Since the paragraph is specified to start on a new page, it begins page two even though it could have fit on page one.
- Parameters:
pageBreak
- - boolean value
-
getSpacingAfter
public int getSpacingAfter()
Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.- Returns:
- int - value representing the spacing after the paragraph
-
setSpacingAfter
public void setSpacingAfter(int spaces)
Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.If the afterLines attribute or the afterAutoSpacing attribute is also specified, then this attribute value is ignored.
- Parameters:
spaces
- - a positive whole number, whose contents consist of a measurement in twentieths of a point.
-
getSpacingAfterLines
public int getSpacingAfterLines()
Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.- Returns:
- int - value representing the spacing after the paragraph
- See Also:
setSpacingAfterLines(int)
-
setSpacingAfterLines
public void setSpacingAfterLines(int spaces)
Specifies the spacing that should be added after the last line in this paragraph in the document in line units. The value of this attribute is specified in one hundredths of a line.If the afterAutoSpacing attribute is also specified, then this attribute value is ignored. If this setting is never specified in the style hierarchy, then its value shall be zero (if needed)
- Parameters:
spaces
- - a positive whole number, whose contents consist of a measurement in hundredths of a line
-
getSpacingBefore
public int getSpacingBefore()
Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.- Returns:
- the spacing that should be added above the first line
- See Also:
setSpacingBefore(int)
-
setSpacingBefore
public void setSpacingBefore(int spaces)
Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.If the beforeLines attribute or the beforeAutoSpacing attribute is also specified, then this attribute value is ignored.
- Parameters:
spaces
-
-
getSpacingBeforeLines
public int getSpacingBeforeLines()
Specifies the spacing that should be added before the first line in this paragraph in the document in line units. The value of this attribute is specified in one hundredths of a line.- Returns:
- the spacing that should be added before the first line in this paragraph
- See Also:
setSpacingBeforeLines(int)
-
setSpacingBeforeLines
public void setSpacingBeforeLines(int spaces)
Specifies the spacing that should be added before the first line in this paragraph in the document in line units. The value of this attribute is specified in one hundredths of a line.If the beforeAutoSpacing attribute is also specified, then this attribute value is ignored. If this setting is never specified in the style hierarchy, then its value shall be zero.
- Parameters:
spaces
-
-
getSpacingLineRule
public LineSpacingRule getSpacingLineRule()
Specifies how the spacing between lines is calculated as stored in the line attribute. If this attribute is omitted, then it shall be assumed to be of a value auto if a line attribute value is present.- Returns:
- rule
- See Also:
LineSpacingRule
,setSpacingLineRule(LineSpacingRule)
-
setSpacingLineRule
public void setSpacingLineRule(LineSpacingRule rule)
Specifies how the spacing between lines is calculated as stored in the line attribute. If this attribute is omitted, then it shall be assumed to be of a value auto if a line attribute value is present.- Parameters:
rule
-- See Also:
LineSpacingRule
-
getSpacingBetween
public double getSpacingBetween()
Return the spacing between lines of a paragraph. The units of the return value depends on theLineSpacingRule
. If AUTO, the return value is in lines, otherwise the return value is in points- Returns:
- a double specifying points or lines.
-
setSpacingBetween
public void setSpacingBetween(double spacing, LineSpacingRule rule)
Sets the spacing between lines in a paragraph- Parameters:
spacing
- - A double specifying spacing in inches or lines. If rule is AUTO, then spacing is in lines. Otherwise spacing is in points.rule
- -LineSpacingRule
indicating how spacing is interpreted. If AUTO, then spacing value is in lines, and the height depends on the font size. If AT_LEAST, then spacing value is in inches, and is the minimum size of the line. If the line height is taller, then the line expands to match. If EXACT, then spacing is the exact line height. If the text is taller than the line height, then it is clipped at the top.
-
setSpacingBetween
public void setSpacingBetween(double spacing)
Sets the spacing between lines in a paragraph- Parameters:
spacing
- - A double specifying spacing in lines.
-
getIndentationLeft
public 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 paragraphIf this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.
- Returns:
- indentation or null if indentation is not set
-
setIndentationLeft
public 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 paragraphIf this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.
- Parameters:
indentation
-
-
getIndentationRight
public 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 paragraphIf this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.
- Returns:
- indentation or null if indentation is not set
-
setIndentationRight
public 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 paragraphIf this attribute is omitted, its value shall be assumed to be zero. Negative values are defined such that the text is moved past the text margin, positive values move the text inside the text margin.
- Parameters:
indentation
-
-
getIndentationHanging
public 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. This indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph. The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored.- Returns:
- indentation or null if indentation is not set
-
setIndentationHanging
public 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. This indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph.The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored.
- Parameters:
indentation
-
-
getIndentationFirstLine
public int getIndentationFirstLine()
Specifies the additional indentation which shall be applied to the first line of the parent paragraph. This additional indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph. The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored. If the firstLineChars attribute is also specified, then this value is ignored. If this attribute is omitted, then its value shall be assumed to be zero (if needed).- Returns:
- indentation or null if indentation is not set
-
setIndentationFirstLine
public void setIndentationFirstLine(int indentation)
Specifies the additional indentation which shall be applied to the first line of the parent paragraph. This additional indentation is specified relative to the paragraph indentation which is specified for all other lines in the parent paragraph. The firstLine and hanging attributes are mutually exclusive, if both are specified, then the firstLine value is ignored. If the firstLineChars attribute is also specified, then this value is ignored. If this attribute is omitted, then its value shall be assumed to be zero (if needed).- Parameters:
indentation
-
-
getIndentFromLeft
public int getIndentFromLeft()
- Specified by:
getIndentFromLeft
in interfaceParagraph
-
setIndentFromLeft
public void setIndentFromLeft(int dxaLeft)
- Specified by:
setIndentFromLeft
in interfaceParagraph
-
getIndentFromRight
public int getIndentFromRight()
- Specified by:
getIndentFromRight
in interfaceParagraph
-
setIndentFromRight
public void setIndentFromRight(int dxaRight)
- Specified by:
setIndentFromRight
in interfaceParagraph
-
getFirstLineIndent
public int getFirstLineIndent()
- Specified by:
getFirstLineIndent
in interfaceParagraph
-
setFirstLineIndent
public void setFirstLineIndent(int first)
- Specified by:
setFirstLineIndent
in interfaceParagraph
-
isWordWrapped
public boolean isWordWrapped()
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).- Specified by:
isWordWrapped
in interfaceParagraph
- Returns:
- boolean
-
setWordWrapped
public void setWordWrapped(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).- Specified by:
setWordWrapped
in interfaceParagraph
- Parameters:
wrap
- - boolean
-
isWordWrap
public boolean isWordWrap()
-
setWordWrap
@Deprecated public void setWordWrap(boolean wrap)
Deprecated.
-
getStyle
public java.lang.String getStyle()
- Returns:
- the style of the paragraph
-
setStyle
public void setStyle(java.lang.String styleId)
Set the style ID for the paragraph- Parameters:
styleId
- ID (not name) of the style to set for the paragraph, e.g. "Heading1" (not "Heading 1").
-
createRun
public XWPFRun createRun()
Appends a new run to this paragraph- Returns:
- a new text run
-
insertNewRun
public XWPFRun insertNewRun(int pos)
insert a new Run in RunArray- Parameters:
pos
- The position at which the new run should be added.- Returns:
- the inserted run or null if the given pos is out of bounds.
-
searchText
public TextSegment searchText(java.lang.String searched, PositionInParagraph startPos)
this methods parse the paragraph and search for the string searched. If it finds the string, it will return true and the position of the String will be saved in the parameter startPos.- Parameters:
searched
-startPos
-
-
getText
public java.lang.String getText(TextSegment segment)
get a Text- Parameters:
segment
-
-
removeRun
public boolean removeRun(int pos)
removes a Run at the position pos in the paragraph- Parameters:
pos
-- Returns:
- true if the run was removed
-
getElementType
public BodyElementType getElementType()
returns the type of the BodyElement Paragraph- Specified by:
getElementType
in interfaceIBodyElement
- See Also:
IBodyElement.getElementType()
-
getBody
public IBody getBody()
- Specified by:
getBody
in interfaceIBodyElement
-
getPart
public POIXMLDocumentPart getPart()
returns the part of the bodyElement- Specified by:
getPart
in interfaceIBodyElement
- Specified by:
getPart
in interfaceIRunBody
- See Also:
IBody.getPart()
-
getPartType
public BodyType getPartType()
returns the partType of the bodyPart which owns the bodyElement- Specified by:
getPartType
in interfaceIBodyElement
- See Also:
IBody.getPartType()
-
addRun
public void addRun(XWPFRun r)
adds a new Run to the Paragraph- Parameters:
r
-
-
getRun
public XWPFRun getRun(CTR r)
return the XWPFRun-Element which owns the CTR run-Element- Parameters:
r
-
-
addFootnoteReference
public void addFootnoteReference(XWPFAbstractFootnoteEndnote footnote)
Add a new run with a reference to the specified footnote. The footnote reference run will have the style name "FootnoteReference".- Parameters:
footnote
- Footnote to which to add a reference.- Since:
- 4.0.0
-
-