Aspose::Words::Drawing::ShapeBase class

ShapeBase class

Base class for objects in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture. To learn more, visit the Working with Shapes documentation article.

class ShapeBase : public Aspose::Words::CompositeNode,
                  public Aspose::Words::IInline,
                  public Aspose::Words::Drawing::Core::IShape,
                  public Aspose::Words::IShapeAttrSource,
                  public Aspose::Words::Revisions::ITrackableNode,
                  public Aspose::Words::Drawing::Core::IFillable,
                  public Aspose::Words::Drawing::Core::IGlow,
                  public Aspose::Words::Drawing::Core::IReflection,
                  public Aspose::Words::Drawing::Core::ISoftEdge,
                  public Aspose::Words::Drawing::Core::IShadow

Methods

MethodDescription
virtual Accept(System::SharedPtr<Aspose::Words::DocumentVisitor>)Accepts a visitor.
virtual AcceptEnd(System::SharedPtr<Aspose::Words::DocumentVisitor>)When implemented in a derived class, calls the VisitXXXEnd method of the specified document visitor.
virtual AcceptStart(System::SharedPtr<Aspose::Words::DocumentVisitor>)When implemented in a derived class, calls the VisitXXXStart method of the specified document visitor.
AdjustWithEffects(System::Drawing::RectangleF)Adds to the source rectangle values of the effect extent and returns the final rectangle.
AppendChild(T)
Clone(bool)Creates a duplicate of the node.
get_AllowOverlap()Gets or sets a value that specifies whether this shape can overlap other shapes.
get_AlternativeText()Defines alternative text to be displayed instead of a graphic.
get_AnchorLocked()Specifies whether the shape’s anchor is locked.
get_AspectRatioLocked()Specifies whether the shape’s aspect ratio is locked.
get_BehindText()Specifies whether the shape is below or above text.
get_Bottom()Gets the position of the bottom edge of the containing block of the shape.
get_Bounds()Gets or sets the location and size of the containing block of the shape.
get_BoundsInPoints()Gets the location and size of the containing block of the shape in points, relative to the anchor of the topmost shape.
get_BoundsWithEffects()Gets final extent that this shape object has after applying drawing effects. Value is measured in points.
get_CanHaveImage()Returns true if the shape type allows the shape to have an image.
get_CoordOrigin()The coordinates at the top-left corner of the containing block of this shape.
get_CoordSize()The width and height of the coordinate space inside the containing block of this shape.
get_Count()Gets the number of immediate children of this node.
get_CustomNodeId() constSpecifies custom node identifier.
get_DistanceBottom()Returns or sets the distance (in points) between the document text and the bottom edge of the shape.
get_DistanceLeft()Returns or sets the distance (in points) between the document text and the left edge of the shape.
get_DistanceRight()Returns or sets the distance (in points) between the document text and the right edge of the shape.
get_DistanceTop()Returns or sets the distance (in points) between the document text and the top edge of the shape.
virtual get_Document() constGets the document to which this node belongs.
get_Fill()Gets fill formatting for the shape.
get_FirstChild() constGets the first child of the node.
get_FlipOrientation()Switches the orientation of a shape.
get_Font()Provides access to the font formatting of this object.
get_Glow()Gets glow formatting for the shape.
get_HasChildNodes()Returns true if this node has any child nodes.
get_Height()Gets or sets the height of the containing block of the shape.
get_HeightRelative()Gets the value that represents the percentage of shape’s relative height.
get_Hidden()Gets a boolean value indicating whether the shape is visible.
get_HorizontalAlignment()Specifies how the shape is positioned horizontally.
get_HRef()Gets or sets the full hyperlink address for a shape.
get_IsComposite() overrideReturns true as this node can have child nodes.
get_IsDecorative()Gets or sets the flag that specifies whether the shape is decorative in the document.
get_IsDeleteRevision()Returns true if this object was deleted in Microsoft Word while change tracking was enabled.
get_IsGroup()Returns true if this is a group shape.
get_IsHorizontalRule()Returns true if this shape is a horizontal rule.
get_IsImage()Returns true if this shape is an image shape.
get_IsInline()A quick way to determine if this shape is positioned inline with text.
get_IsInsertRevision()Returns true if this object was inserted in Microsoft Word while change tracking was enabled.
get_IsLayoutInCell()Gets or sets a flag indicating whether the shape is displayed inside a table or outside of it.
get_IsMoveFromRevision()Returns true if this object was moved (deleted) in Microsoft Word while change tracking was enabled.
get_IsMoveToRevision()Returns true if this object was moved (inserted) in Microsoft Word while change tracking was enabled.
get_IsSignatureLine()Indicates that shape is a SignatureLine.
get_IsTopLevel()Returns true if this shape is not a child of a group shape.
get_IsWordArt()Returns true if this shape is a WordArt object.
get_LastChild() constGets the last child of the node.
get_Left()Gets or sets the position of the left edge of the containing block of the shape.
get_LeftRelative()Gets the value that represents shape’s relative left position in percent.
get_MarkupLanguage() constGets MarkupLanguage used for this graphic object.
get_Name()Gets or sets the optional shape name.
get_NextNode() const
get_NextSibling()Gets the node immediately following this node.
virtual get_NodeType() constGets the type of this node.
get_ParentNode()Gets the immediate parent of this node.
get_ParentParagraph()Returns the immediate parent paragraph.
get_PreviousSibling()Gets the node immediately preceding this node.
get_PrevNode() const
get_Range()Returns a Range object that represents the portion of a document that is contained in this node.
get_Reflection()Gets reflection formatting for the shape.
get_RelativeHorizontalPosition()Specifies relative to what the shape is positioned horizontally.
get_RelativeHorizontalSize()Gets or sets the value of shape’s relative size in horizontal direction.
get_RelativeVerticalPosition()Specifies relative to what the shape is positioned vertically.
get_RelativeVerticalSize()Gets or sets the value of shape’s relative size in vertical direction.
get_Right()Gets the position of the right edge of the containing block of the shape.
get_Rotation()Defines the angle (in degrees) that a shape is rotated. Positive value corresponds to clockwise rotation angle.
get_ScreenTip()Defines the text displayed when the mouse pointer moves over the shape.
get_ShadowFormat()Gets shadow formatting for the shape.
get_ShapeType()Gets the shape type.
get_SizeInPoints()Gets the size of the shape in points.
get_SoftEdge()Gets soft edge formatting for the shape.
get_Target()Gets or sets the target frame for the shape hyperlink.
get_Title()Gets or sets the title (caption) of the current shape object.
get_Top()Gets or sets the position of the top edge of the containing block of the shape.
get_TopRelative()Gets the value that represents shape’s relative top position in percent.
get_VerticalAlignment()Specifies how the shape is positioned vertically.
get_Width()Gets or sets the width of the containing block of the shape.
get_WidthRelative()Gets the value that represents the percentage of shape’s relative width.
get_WrapSide()Specifies how the text is wrapped around the shape.
get_WrapType()Defines whether the shape is inline or floating. For floating shapes defines the wrapping mode for text around the shape.
get_ZOrder()Determines the display order of overlapping shapes.
GetAncestor(Aspose::Words::NodeType)Gets the first ancestor of the specified NodeType.
GetAncestorOf()
GetChild(Aspose::Words::NodeType, int32_t, bool)Returns an Nth child node that matches the specified type.
GetChildNodes(Aspose::Words::NodeType, bool)Returns a live collection of child nodes that match the specified type.
GetEnumerator() overrideProvides support for the for each style iteration over the child nodes of this node.
GetShapeRenderer()Creates and returns an object that can be used to render this shape into an image.
GetText() overrideGets the text of this node and of all its children.
GetType() const override
IndexOf(const System::SharedPtr<Aspose::Words::Node>&)Returns the index of the specified child node in the child node array.
InsertAfter(T, const System::SharedPtr<Aspose::Words::Node>&)
InsertBefore(T, const System::SharedPtr<Aspose::Words::Node>&)
Is(const System::TypeInfo&) const override
IsAncestorNode(const System::SharedPtr<Aspose::Words::Node>&)
LocalToParent(System::Drawing::PointF)Converts a value from the local coordinate space into the coordinate space of the parent shape.
NextPreOrder(const System::SharedPtr<Aspose::Words::Node>&)Gets next node according to the pre-order tree traversal algorithm.
static NodeTypeToString(Aspose::Words::NodeType)A utility method that converts a node type enum value into a user friendly string.
PrependChild(T)
PreviousPreOrder(const System::SharedPtr<Aspose::Words::Node>&)Gets the previous node according to the pre-order tree traversal algorithm.
Remove()Removes itself from the parent.
RemoveAllChildren()Removes all the child nodes of the current node.
RemoveChild(T)
RemoveSmartTags()Removes all SmartTag descendant nodes of the current node.
SelectNodes(const System::String&)Selects a list of nodes matching the XPath expression.
SelectSingleNode(const System::String&)Selects the first Node that matches the XPath expression.
set_AllowOverlap(bool)Setter for Aspose::Words::Drawing::ShapeBase::get_AllowOverlap.
set_AlternativeText(const System::String&)Defines alternative text to be displayed instead of a graphic.
set_AnchorLocked(bool)Setter for Aspose::Words::Drawing::ShapeBase::get_AnchorLocked.
set_AspectRatioLocked(bool)Setter for Aspose::Words::Drawing::ShapeBase::get_AspectRatioLocked.
set_BehindText(bool)Setter for Aspose::Words::Drawing::ShapeBase::get_BehindText.
set_Bounds(System::Drawing::RectangleF)Setter for Aspose::Words::Drawing::ShapeBase::get_Bounds.
set_CoordOrigin(System::Drawing::Point)Setter for Aspose::Words::Drawing::ShapeBase::get_CoordOrigin.
set_CoordSize(System::Drawing::Size)Setter for Aspose::Words::Drawing::ShapeBase::get_CoordSize.
set_CustomNodeId(int32_t)Setter for Aspose::Words::Node::get_CustomNodeId.
set_DistanceBottom(double)Setter for Aspose::Words::Drawing::ShapeBase::get_DistanceBottom.
set_DistanceLeft(double)Setter for Aspose::Words::Drawing::ShapeBase::get_DistanceLeft.
set_DistanceRight(double)Setter for Aspose::Words::Drawing::ShapeBase::get_DistanceRight.
set_DistanceTop(double)Setter for Aspose::Words::Drawing::ShapeBase::get_DistanceTop.
set_FlipOrientation(Aspose::Words::Drawing::FlipOrientation)Setter for Aspose::Words::Drawing::ShapeBase::get_FlipOrientation.
set_Height(double)Setter for Aspose::Words::Drawing::ShapeBase::get_Height.
set_HeightRelative(float)Sets the value that represents the percentage of shape’s relative height.
set_Hidden(bool)Sets a boolean value indicating whether the shape is visible.
set_HorizontalAlignment(Aspose::Words::Drawing::HorizontalAlignment)Setter for Aspose::Words::Drawing::ShapeBase::get_HorizontalAlignment.
set_HRef(const System::String&)Setter for Aspose::Words::Drawing::ShapeBase::get_HRef.
set_IsDecorative(bool)Setter for Aspose::Words::Drawing::ShapeBase::get_IsDecorative.
set_IsLayoutInCell(bool)Setter for Aspose::Words::Drawing::ShapeBase::get_IsLayoutInCell.
set_Left(double)Setter for Aspose::Words::Drawing::ShapeBase::get_Left.
set_LeftRelative(float)Sets the value that represents shape’s relative left position in percent.
set_Name(const System::String&)Setter for Aspose::Words::Drawing::ShapeBase::get_Name.
set_NextNode(const System::SharedPtr<Aspose::Words::Node>&)
set_PrevNode(const System::SharedPtr<Aspose::Words::Node>&)
set_RelativeHorizontalPosition(Aspose::Words::Drawing::RelativeHorizontalPosition)Setter for Aspose::Words::Drawing::ShapeBase::get_RelativeHorizontalPosition.
set_RelativeHorizontalSize(Aspose::Words::Drawing::RelativeHorizontalSize)Setter for Aspose::Words::Drawing::ShapeBase::get_RelativeHorizontalSize.
set_RelativeVerticalPosition(Aspose::Words::Drawing::RelativeVerticalPosition)Setter for Aspose::Words::Drawing::ShapeBase::get_RelativeVerticalPosition.
set_RelativeVerticalSize(Aspose::Words::Drawing::RelativeVerticalSize)Setter for Aspose::Words::Drawing::ShapeBase::get_RelativeVerticalSize.
set_Rotation(double)Setter for Aspose::Words::Drawing::ShapeBase::get_Rotation.
set_ScreenTip(const System::String&)Setter for Aspose::Words::Drawing::ShapeBase::get_ScreenTip.
set_Target(const System::String&)Setter for Aspose::Words::Drawing::ShapeBase::get_Target.
set_Title(const System::String&)Setter for Aspose::Words::Drawing::ShapeBase::get_Title.
set_Top(double)Setter for Aspose::Words::Drawing::ShapeBase::get_Top.
set_TopRelative(float)Sets the value that represents shape’s relative top position in percent.
set_VerticalAlignment(Aspose::Words::Drawing::VerticalAlignment)Setter for Aspose::Words::Drawing::ShapeBase::get_VerticalAlignment.
set_Width(double)Setter for Aspose::Words::Drawing::ShapeBase::get_Width.
set_WidthRelative(float)Sets the value that represents the percentage of shape’s relative width.
set_WrapSide(Aspose::Words::Drawing::WrapSide)Setter for Aspose::Words::Drawing::ShapeBase::get_WrapSide.
set_WrapType(Aspose::Words::Drawing::WrapType)Setter for Aspose::Words::Drawing::ShapeBase::get_WrapType.
set_ZOrder(int32_t)Setter for Aspose::Words::Drawing::ShapeBase::get_ZOrder.
SetParent(const System::SharedPtr<Aspose::Words::Node>&)
SetTemplateWeakPtr(uint32_t) override
ToString(Aspose::Words::SaveFormat)Exports the content of the node into a string in the specified format.
ToString(const System::SharedPtr<Aspose::Words::Saving::SaveOptions>&)Exports the content of the node into a string using the specified save options.
static Type()

Remarks

This is an abstract class. The two derived classes that you can instantiate are Shape and GroupShape.

A shape is a node in the document tree.

If the shape is a child of a Paragraph object, then the shape is said to be “top-level”. Top-level shapes are measured and positioned in points.

A shape can also occur as a child of a GroupShape object when several shapes are grouped. Child shapes of a group shape are positioned in the coordinate space and units defined by the CoordSize and CoordOrigin properties of the parent group shape.

A shape can be positioned inline with text or floating. The positioning method is controlled using the WrapType property.

When a shape is floating, it is positioned relative to something (e.g the current paragraph, the margin or the page). The relative positioning of the shape is specified using the RelativeHorizontalPosition and RelativeVerticalPosition properties.

A floating shape be positioned explicitly using the Left and Top properties or aligned relative to some other object using the HorizontalAlignment and VerticalAlignment properties.

Examples

Shows how to insert a floating image to the center of a page.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

// Insert a floating image that will appear behind the overlapping text and align it to the page's center.
SharedPtr<Shape> shape = builder->InsertImage(ImageDir + u"Logo.jpg");
shape->set_WrapType(WrapType::None);
shape->set_BehindText(true);
shape->set_RelativeHorizontalPosition(RelativeHorizontalPosition::Page);
shape->set_RelativeVerticalPosition(RelativeVerticalPosition::Page);
shape->set_HorizontalAlignment(HorizontalAlignment::Center);
shape->set_VerticalAlignment(VerticalAlignment::Center);

doc->Save(ArtifactsDir + u"Image.CreateFloatingPageCenter.docx");

See Also