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.

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 = System::MakeObject<Aspose::Words::Document>(System::String(get_MyDir() + u"Paragraph frame.docx"));

System::SharedPtr<Aspose::Words::Paragraph> paragraphFrame = doc->get_FirstSection()->get_Body()->get_Paragraphs()->LINQ_OfType<System::SharedPtr<Aspose::Words::Paragraph>>()->LINQ_First(static_cast<System::Func<System::SharedPtr<Aspose::Words::Paragraph>, bool>>(static_cast<std::function<bool(System::SharedPtr<Aspose::Words::Paragraph> p)>>([](System::SharedPtr<Aspose::Words::Paragraph> p) -> bool
{
    return p->get_FrameFormat()->get_IsFrame();
})));

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

See Also