org.apache.poi.xwpf.usermodel
Class XWPFParagraph
- java.lang.Object
-
- org.apache.poi.xwpf.usermodel.XWPFParagraph
-
- All Implemented Interfaces:
- IBodyElement, IRunBody, ISDTContents
public class XWPFParagraph extends java.lang.Object implements IBodyElement, IRunBody, ISDTContents
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
XWPFRuns.
-
-
Constructor Summary
Constructors Constructor and Description XWPFParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP prgrph, IBody part)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidaddRun(XWPFRun r)adds a new Run to the ParagraphXWPFRuncreateRun()Appends a new run to this paragraphParagraphAlignmentgetAlignment()Returns the paragraph alignment which shall be applied to text in this paragraph.IBodygetBody()BordersgetBorderBetween()Specifies the border which shall be displayed between each paragraph in a set of paragraphs which have the same set of paragraph border settings.BordersgetBorderBottom()Specifies the border which shall be displayed below a set of paragraphs which have the same set of paragraph border settings.BordersgetBorderLeft()Specifies the border which shall be displayed on the left side of the page around the specified paragraph.BordersgetBorderRight()Specifies the border which shall be displayed on the right side of the page around the specified paragraph.BordersgetBorderTop()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.CTPgetCTP()XWPFDocumentgetDocument()BodyElementTypegetElementType()returns the type of the BodyElement ParagraphintgetFirstLineIndent()intgetFontAlignment()java.lang.StringgetFootnoteText()Returns the footnote text of the paragraphintgetIndentationFirstLine()Specifies the additional indentation which shall be applied to the first line of the parent paragraph.intgetIndentationHanging()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.intgetIndentationLeft()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.intgetIndentationRight()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.intgetIndentFromLeft()intgetIndentFromRight()java.util.List<IRunElement>getIRuns()Return literal runs and sdt/content control objects.java.lang.StringgetNumFmt()Returns numbering format for this paragraph, eg bullet or lowerLetter.java.math.BigIntegergetNumID()If style exist for this paragraph NumId of the paragraph will be returned.java.math.BigIntegergetNumIlvl()Returns Ilvl of the numeric style for this paragraph.java.lang.StringgetNumLevelText()Returns the text that should be used around the paragraph level numbers.java.math.BigIntegergetNumStartOverride()Gets the numstartOverride for the paragraph numbering for this paragraph.java.lang.StringgetParagraphText()Returns the text of the paragraph, but not of any objects in the paragraphPOIXMLDocumentPartgetPart()returns the part of the bodyElementBodyTypegetPartType()returns the partType of the bodyPart which owns the bodyElementjava.lang.StringgetPictureText()Returns any text from any suitable pictures in the paragraphXWPFRungetRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR r)return the XWPFRun-Element which owns the CTR run-Elementjava.util.List<XWPFRun>getRuns()intgetSpacingAfter()Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.intgetSpacingAfterLines()Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.intgetSpacingBefore()Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.intgetSpacingBeforeLines()Specifies the spacing that should be added before the first line in this paragraph in the document in line units.LineSpacingRulegetSpacingLineRule()Specifies how the spacing between lines is calculated as stored in the line attribute.java.lang.StringgetStyle()java.lang.StringgetStyleID()Return styleID of the paragraph if style exist for this paragraph if not, null will be returnedjava.lang.StringgetText()Return the textual content of the paragraph, including text from pictures and sdt elements in it.java.lang.StringgetText(TextSegement segment)get a TextTextAlignmentgetVerticalAlignment()Returns the text vertical alignment which shall be applied to text in this paragraph.XWPFRuninsertNewRun(int pos)insert a new Run in RunArraybooleanisEmpty()booleanisPageBreak()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.booleanisWordWrap()booleanisWordWrapped()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).booleanremoveRun(int pos)removes a Run at the position pos in the paragraphTextSegementsearchText(java.lang.String searched, PositionInParagraph startPos)this methods parse the paragraph and search for the string searched.voidsetAlignment(ParagraphAlignment align)Specifies the paragraph alignment which shall be applied to text in this paragraph.voidsetBorderBetween(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.voidsetBorderBottom(Borders border)Specifies the border which shall be displayed below a set of paragraphs which have the same set of paragraph border settings.voidsetBorderLeft(Borders border)Specifies the border which shall be displayed on the left side of the page around the specified paragraph.voidsetBorderRight(Borders border)Specifies the border which shall be displayed on the right side of the page around the specified paragraph.voidsetBorderTop(Borders border)Specifies the border which shall be displayed above a set of paragraphs which have the same set of paragraph border settings.voidsetFirstLineIndent(int first)voidsetFontAlignment(int align)voidsetIndentationFirstLine(int indentation)Specifies the additional indentation which shall be applied to the first line of the parent paragraph.voidsetIndentationHanging(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.voidsetIndentationLeft(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.voidsetIndentationRight(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.voidsetIndentFromLeft(int dxaLeft)voidsetIndentFromRight(int dxaRight)voidsetNumID(java.math.BigInteger numPos)setNumID of ParagraphvoidsetPageBreak(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.voidsetSpacingAfter(int spaces)Specifies the spacing that should be added after the last line in this paragraph in the document in absolute units.voidsetSpacingAfterLines(int spaces)Specifies the spacing that should be added after the last line in this paragraph in the document in line units.voidsetSpacingBefore(int spaces)Specifies the spacing that should be added above the first line in this paragraph in the document in absolute units.voidsetSpacingBeforeLines(int spaces)Specifies the spacing that should be added before the first line in this paragraph in the document in line units.voidsetSpacingLineRule(LineSpacingRule rule)Specifies how the spacing between lines is calculated as stored in the line attribute.voidsetStyle(java.lang.String newStyle)This method provides a style to the paragraph This is useful when, e.g.voidsetVerticalAlignment(TextAlignment valign)Specifies the text vertical alignment which shall be applied to text in this paragraph.voidsetWordWrap(boolean wrap)Deprecated.voidsetWordWrapped(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).
-
-
-
Constructor Detail
-
XWPFParagraph
public XWPFParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP prgrph, IBody part)
-
-
Method Detail
-
getCTP
@Internal public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP getCTP()
-
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:
getDocumentin 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
-
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.
-
setNumID
public void setNumID(java.math.BigInteger numPos)
setNumID of Paragraph- Parameters:
numPos-
-
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()
- Returns:
- The raw alignment value,
getAlignment()is suggested
-
setFontAlignment
public void setFontAlignment(int align)
-
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.
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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.
-
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
-
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 twentieths of a
-
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:
- bigInteger - value representing the spacing after the paragraph
- See Also:
setSpacingAfterLines(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-
-
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)
-
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-
-
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)
-
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
-
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)
-
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 paragraph If 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-
-
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 paragraph If 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 paragraph If 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 paragraph If 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
-
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-
-
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
-
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-
-
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
-
getIndentFromLeft
public int getIndentFromLeft()
-
setIndentFromLeft
public void setIndentFromLeft(int dxaLeft)
-
getIndentFromRight
public int getIndentFromRight()
-
setIndentFromRight
public void setIndentFromRight(int dxaRight)
-
getFirstLineIndent
public int getFirstLineIndent()
-
setFirstLineIndent
public void setFirstLineIndent(int first)
-
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).- Parameters:
wrap- - boolean
-
setWordWrap
@Deprecated public void setWordWrap(boolean wrap)
Deprecated.
-
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).- Returns:
- boolean
-
isWordWrap
public boolean isWordWrap()
-
setStyle
public void setStyle(java.lang.String newStyle)
This method provides a style to the paragraph This is useful when, e.g. an Heading style has to be assigned- Parameters:
newStyle-
-
getStyle
public java.lang.String getStyle()
- Returns:
- the style of the paragraph
-
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-- Returns:
- the inserted run
-
searchText
public TextSegement 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(TextSegement 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:
getElementTypein interfaceIBodyElement- See Also:
IBodyElement.getElementType()
-
getBody
public IBody getBody()
- Specified by:
getBodyin interfaceIBodyElement
-
getPart
public POIXMLDocumentPart getPart()
returns the part of the bodyElement- Specified by:
getPartin interfaceIBodyElement- Specified by:
getPartin interfaceIRunBody- See Also:
IBody.getPart()
-
getPartType
public BodyType getPartType()
returns the partType of the bodyPart which owns the bodyElement- Specified by:
getPartTypein interfaceIBodyElement- See Also:
IBody.getPartType()
-
addRun
public void addRun(XWPFRun r)
adds a new Run to the Paragraph- Parameters:
r-
-
getRun
public XWPFRun getRun(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR r)
return the XWPFRun-Element which owns the CTR run-Element- Parameters:
r-
-
-
DataMelt 3.0 © DataMelt by jWork.ORG