public class FrameFormat
extends java.lang.Object
Remarks:
This object is always created. If a paragraph is a frame, then all properties will contain respective values, otherwise all properties are set to their defaults.
Use isFrame() to check whether paragraph is a frame.
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
| Modifier and Type | Method and Description |
|---|---|
double |
getHeight()
Gets the height of the specified frame.
|
int |
getHeightRule()
Gets the rule for determining the height of the specified frame.
|
int |
getHorizontalAlignment()
Gets horizontal alignment of the specified frame.
|
double |
getHorizontalDistanceFromText()
Gets horizontal distance between a frame and the surrounding text, in points.
|
double |
getHorizontalPosition()
Gets horizontal distance between the edge of the frame and the item specified by the
getRelativeHorizontalPosition() property. |
int |
getRelativeHorizontalPosition()
Gets the relative horizontal position of a frame.
|
int |
getRelativeVerticalPosition()
Gets the relative vertical position of a frame.
|
int |
getVerticalAlignment()
Gets vertical alignment of the specified frame.
|
double |
getVerticalDistanceFromText()
Specifies vertical distance (in points) between a frame and the surrounding text.
|
double |
getVerticalPosition()
Gets vertical distance between the edge of the frame and the item specified by the
getRelativeVerticalPosition() property. |
double |
getWidth()
Gets the width of the specified frame, in points.
|
boolean |
isFrame()
Returns
true if the paragraph is a frame. |
public int getHeightRule()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
HeightRule constants.public double getHeight()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
public double getHorizontalDistanceFromText()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
public double getHorizontalPosition()
getRelativeHorizontalPosition() property.
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
getRelativeHorizontalPosition() property.public int getRelativeHorizontalPosition()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
RelativeHorizontalPosition constants.public int getRelativeVerticalPosition()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
RelativeVerticalPosition constants.public double getVerticalDistanceFromText()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
double value.public double getVerticalPosition()
getRelativeVerticalPosition() property.
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
getRelativeVerticalPosition() property.public double getWidth()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
public int getVerticalAlignment()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
VerticalAlignment constants.public int getHorizontalAlignment()
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
HorizontalAlignment constants.public boolean isFrame()
true if the paragraph is a frame.
Examples:
Shows how to get information about formatting properties of paragraphs that are frames.
Document doc = new Document(getMyDir() + "Paragraph frame.docx");
Paragraph paragraphFrame = IterableUtils.find(doc.getFirstSection().getBody().getParagraphs(), p -> p.getFrameFormat().isFrame());
Assert.assertEquals(233.3d, paragraphFrame.getFrameFormat().getWidth());
Assert.assertEquals(138.8d, paragraphFrame.getFrameFormat().getHeight());
Assert.assertEquals(HeightRule.AT_LEAST, paragraphFrame.getFrameFormat().getHeightRule());
Assert.assertEquals(HorizontalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getHorizontalAlignment());
Assert.assertEquals(VerticalAlignment.DEFAULT, paragraphFrame.getFrameFormat().getVerticalAlignment());
Assert.assertEquals(34.05d, paragraphFrame.getFrameFormat().getHorizontalPosition());
Assert.assertEquals(RelativeHorizontalPosition.PAGE, paragraphFrame.getFrameFormat().getRelativeHorizontalPosition());
Assert.assertEquals(9.0d, paragraphFrame.getFrameFormat().getHorizontalDistanceFromText());
Assert.assertEquals(20.5d, paragraphFrame.getFrameFormat().getVerticalPosition());
Assert.assertEquals(RelativeVerticalPosition.PARAGRAPH, paragraphFrame.getFrameFormat().getRelativeVerticalPosition());
Assert.assertEquals(0.0d, paragraphFrame.getFrameFormat().getVerticalDistanceFromText());
true if the paragraph is a frame.