Class StandardParagraph
java.lang.Object
pro.verron.officestamper.core.StandardParagraph
- All Implemented Interfaces:
Paragraph
-
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the given consumer to the paragraph represented by the current instance.asString()Returns the aggregated text over all runs.static StandardParagraphCreates a new instance ofStandardParagraphfrom the providedDocxPartand parent object.static StandardParagraphCreates a new instance of StandardParagraph from the provided DocxPart and CTSdtContentRun objects.static StandardParagraphCreates a new instance of StandardParagraph using the provided DocxPart and P objects.Collection<org.docx4j.wml.Comments.Comment> Retrieves the collection of comments associated with the current paragraph.<T> Optional<T> Retrieves the nearest parent of the specified type for the current paragraph.Retrieves the parent table of the current paragraph, if it exists.Retrieves the parent table row of the current paragraph, if it exists.voidremove()Removes the paragraph represented by the current instance.voidReplaces a section of elements within the document, defined by the start and end objects, with the elements provided by the given insert.voidReplaces a specified placeholder within the paragraph with the provided insert.voidReplaces a set of paragraph elements with new ones within the current paragraph's siblings.toString()Returns the string representation of the paragraph.
-
Method Details
-
from
Creates a new instance ofStandardParagraphfrom the providedDocxPartand parent object.- Parameters:
part- the source DocxPart.parent- the parent object.- Returns:
- a new StandardParagraph instance.
-
from
Creates a new instance of StandardParagraph using the provided DocxPart and P objects.- Parameters:
source- the source DocxPart containing the paragraph.paragraph- the P object representing the structure and content of the paragraph.- Returns:
- a new instance of StandardParagraph constructed based on the provided source and paragraph.
-
from
Creates a new instance of StandardParagraph from the provided DocxPart and CTSdtContentRun objects.- Parameters:
source- the source DocxPart containing the paragraph content.paragraph- the CTSdtContentRun object representing the content of the paragraph.- Returns:
- a new instance of StandardParagraph constructed based on the provided DocxPart and paragraph.
-
replace
Replaces a set of paragraph elements with new ones within the current paragraph's siblings. Ensures that the elements to be removed are replaced in the appropriate position.- Specified by:
replacein interfaceParagraph- Parameters:
toRemove- the list of paragraph elements to be removed.toAdd- the list of paragraph elements to be added.- Throws:
OfficeStamperException- if the current paragraph object is not found in its siblings.
-
remove
-
replace
Description copied from interface:ParagraphReplaces a specified placeholder within the paragraph with the provided insert. -
replace
Description copied from interface:ParagraphReplaces a section of elements within the document, defined by the start and end objects, with the elements provided by the given insert. -
asString
-
apply
Applies the given consumer to the paragraph represented by the current instance. This method facilitates custom processing by allowing the client to define specific operations to be performed on the paragraph's internal structure. -
parent
Retrieves the nearest parent of the specified type for the current paragraph. The search is performed starting from the current paragraph and traversing up to the root, with a default maximum depth of Integer.MAX_VALUE. -
getComment
Retrieves the collection of comments associated with the current paragraph.- Specified by:
getCommentin interfaceParagraph- Returns:
- a collection of
Comments.Commentobjects related to the paragraph.
-
parentTableRow
-
parentTable
-
toString
-