FrameFormat class

FrameFormat class

Represents frame related formatting for a paragraph.

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 FrameFormat.isFrame to check whether paragraph is a frame.

Properties

NameDescription
heightGets the height of the specified frame.
heightRuleGets the rule for determining the height of the specified frame.
horizontalAlignmentGets horizontal alignment of the specified frame.
horizontalDistanceFromTextGets horizontal distance between a frame and the surrounding text, in points.
horizontalPositionGets horizontal distance between the edge of the frame and the item specified by the FrameFormat.relativeHorizontalPosition property.
isFrameReturns true if the paragraph is a frame.
relativeHorizontalPositionGets the relative horizontal position of a frame.
relativeVerticalPositionGets the relative vertical position of a frame.
verticalAlignmentGets vertical alignment of the specified frame.
verticalDistanceFromTextSpecifies vertical distance (in points) between a frame and the surrounding text.
verticalPositionGets vertical distance between the edge of the frame and the item specified by the FrameFormat.relativeVerticalPosition property.
widthGets the width of the specified frame, in points.

Examples

Shows how to get information about formatting properties of paragraphs that are frames.

let doc = new aw.Document(base.myDir + "Paragraph frame.docx");
let paragraphFrame = doc.firstSection.body.paragraphs.toArray().filter(p => p.frameFormat.isFrame).at(0);

expect(paragraphFrame.frameFormat.width).toEqual(233.3);
expect(paragraphFrame.frameFormat.height).toEqual(138.8);
expect(paragraphFrame.frameFormat.heightRule).toEqual(aw.HeightRule.AtLeast);
expect(paragraphFrame.frameFormat.horizontalAlignment).toEqual(aw.Drawing.HorizontalAlignment.Default);
expect(paragraphFrame.frameFormat.verticalAlignment).toEqual(aw.Drawing.VerticalAlignment.Default);
expect(paragraphFrame.frameFormat.horizontalPosition).toEqual(34.05);
expect(paragraphFrame.frameFormat.relativeHorizontalPosition).toEqual(aw.Drawing.RelativeHorizontalPosition.Page);
expect(paragraphFrame.frameFormat.horizontalDistanceFromText).toEqual(9.0);
expect(paragraphFrame.frameFormat.verticalPosition).toEqual(20.5);
expect(paragraphFrame.frameFormat.relativeVerticalPosition).toEqual(aw.Drawing.RelativeVerticalPosition.Paragraph);
expect(paragraphFrame.frameFormat.verticalDistanceFromText).toEqual(0.0);

See Also