Aspose::Words::FrameFormat class

FrameFormat class

Represents frame related formatting for a paragraph.

class FrameFormat : public System::Object

Methods

MethodDescription
get_Height()Gets the height of the specified frame.
get_HeightRule()Gets the rule for determining the height of the specified frame.
get_HorizontalAlignment()Gets horizontal alignment of the specified frame.
get_HorizontalDistanceFromText()Gets horizontal distance between a frame and the surrounding text, in points.
get_HorizontalPosition()Gets horizontal distance between the edge of the frame and the item specified by the RelativeHorizontalPosition property.
get_IsFrame()Returns true if the paragraph is a frame.
get_RelativeHorizontalPosition()Gets the relative horizontal position of a frame.
get_RelativeVerticalPosition()Gets the relative vertical position of a frame.
get_VerticalAlignment()Gets vertical alignment of the specified frame.
get_VerticalDistanceFromText()Specifies vertical distance (in points) between a frame and the surrounding text.
get_VerticalPosition()Gets vertical distance between the edge of the frame and the item specified by the RelativeVerticalPosition property.
get_Width()Gets the width of the specified frame, in points.
GetType() const override
Is(const System::TypeInfo&) const override
static Type()

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.

auto doc = MakeObject<Document>(MyDir + u"Paragraph frame.docx");

SharedPtr<Paragraph> paragraphFrame = doc->get_FirstSection()->get_Body()->get_Paragraphs()->LINQ_OfType<SharedPtr<Paragraph>>()->LINQ_First(
    [](SharedPtr<Paragraph> p) { return p->get_FrameFormat()->get_IsFrame(); });

ASPOSE_ASSERT_EQ(233.3, paragraphFrame->get_FrameFormat()->get_Width());
ASPOSE_ASSERT_EQ(138.8, paragraphFrame->get_FrameFormat()->get_Height());
ASSERT_EQ(HeightRule::AtLeast, paragraphFrame->get_FrameFormat()->get_HeightRule());
ASSERT_EQ(HorizontalAlignment::Default, paragraphFrame->get_FrameFormat()->get_HorizontalAlignment());
ASSERT_EQ(VerticalAlignment::Default, paragraphFrame->get_FrameFormat()->get_VerticalAlignment());
ASPOSE_ASSERT_EQ(34.05, paragraphFrame->get_FrameFormat()->get_HorizontalPosition());
ASSERT_EQ(RelativeHorizontalPosition::Page, paragraphFrame->get_FrameFormat()->get_RelativeHorizontalPosition());
ASPOSE_ASSERT_EQ(9.0, paragraphFrame->get_FrameFormat()->get_HorizontalDistanceFromText());
ASPOSE_ASSERT_EQ(20.5, paragraphFrame->get_FrameFormat()->get_VerticalPosition());
ASSERT_EQ(RelativeVerticalPosition::Paragraph, paragraphFrame->get_FrameFormat()->get_RelativeVerticalPosition());
ASPOSE_ASSERT_EQ(0.0, paragraphFrame->get_FrameFormat()->get_VerticalDistanceFromText());

See Also