java.lang.Object
org.wickedsource.docxstamper.util.RunUtil
Utility class to handle runs.
- Since:
- 1.0.0
- Version:
- ${version}
- Author:
- Joseph Verron, Tom Hombergs
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyParagraphStyle(org.docx4j.wml.P p, org.docx4j.wml.R run) Applies the style of the given paragraph to the given content object (if the content object is a Run).static org.docx4j.wml.RCreates a new run with the specified text.static org.docx4j.wml.RCreates a new run with the specified text and inherits the style of the parent paragraph.static org.docx4j.wml.RcreateRunWithImage(Integer maxWidth, org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage abstractImage) Creates a run containing the given image.static org.docx4j.wml.TextcreateText(String text) Creates a text object with the given text.static StringgetText(org.docx4j.wml.R run) Returns the text string of a run.static voidSets the text of the given run to the given value.
-
Method Details
-
getText
Returns the text string of a run.- Parameters:
run- the run whose text to get.- Returns:
Stringrepresentation of the run.
-
create
Creates a new run with the specified text and inherits the style of the parent paragraph.- Parameters:
text- the initial text of the run.parentParagraph- the parent paragraph whose style to inherit.- Returns:
- the newly created run.
-
create
Creates a new run with the specified text.- Parameters:
text- the initial text of the run.- Returns:
- the newly created run.
-
applyParagraphStyle
public static void applyParagraphStyle(org.docx4j.wml.P p, org.docx4j.wml.R run) Applies the style of the given paragraph to the given content object (if the content object is a Run).- Parameters:
p- the paragraph whose style to use.run- the Run to which the style should be applied.
-
setText
Sets the text of the given run to the given value.- Parameters:
run- the run whose text to change.text- the text to set.
-
createText
Creates a text object with the given text.- Parameters:
text- the text to set.- Returns:
- the newly created text object.
-
createRunWithImage
public static org.docx4j.wml.R createRunWithImage(Integer maxWidth, org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage abstractImage) Creates a run containing the given image.- Parameters:
maxWidth- max width of the imageabstractImage- the image- Returns:
- the run containing the image
-