Shapes Interface

Definition

A collection of Shape objects that represent all the shapes in a document or all the shapes in all the headers and footers in a document.

public interface class Shapes : System::Collections::IEnumerable
[System.Runtime.InteropServices.Guid("0002099F-0000-0000-C000-000000000046")]
public interface Shapes : System.Collections.IEnumerable
type Shapes = interface
    interface IEnumerable
Public Interface Shapes
Implements IEnumerable
Attributes
Implements

Remarks

Each Shape object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Note If you want to work with a subset of the shapes on a document— for example, to do something to only the AutoShapes on the document or to only the selected shapes— you must construct a ShapeRange collection that contains the shapes you want to work with.

Use the Shapes property to return the Shapes collection.

Note If you want to do something (like delete or set a property) to all the shapes on a document at the same time, use the Range(Object) method to create a ShapeRange object that contains all the shapes in the Shapes collection, and then apply the appropriate property or method to the ShapeRange object.

Use one of the following methods of the Shapes collection: AddCallout(MsoCalloutType, Single, Single, Single, Single, Object), AddCurve(Object, Object), AddLabel(MsoTextOrientation, Single, Single, Single, Single, Object), AddLine(Single, Single, Single, Single, Object), AddOLEControl(Object, Object, Object, Object, Object, Object), AddOLEObject(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object), AddPolyline(Object, Object), AddShape(Int32, Single, Single, Single, Single, Object), AddTextbox(MsoTextOrientation, Single, Single, Single, Single, Object), AddTextEffect(MsoPresetTextEffect, String, String, Single, MsoTriState, MsoTriState, Single, Single, Object), or BuildFreeform(MsoEditingType, Single, Single) to add a shape to a document and return a Shape object that represents the newly created shape.

Use Shapes(index), where index is the name or the index number, to return a single Shape object.

Each shape is assigned a default name when it is created. For example, if you add three different shapes to a document, they might be named "Rectangle 2," "TextBox 3," and "Oval 4." To give a shape a more meaningful name, set the Name property.

The Shapes collection does not include InlineShape objects. InlineShape objects are treated like characters and are positioned as characters within a line of text. Shape objects are anchored to a range of text but are free-floating and can be positioned anywhere on the page. You can use the ConvertToInlineShape() method and the ConvertToShape(Object) method to convert shapes from one type to the other. You can convert only pictures, OLE objects, and ActiveX controls to inline shapes.

The Count property for this collection in a document returns the number of items in the main story only. To count the shapes in all the headers and footers, use the Shapes collection with any HeaderFooter object.

Properties

Application

Returns a Application object that represents the Microsoft Word application.

Count

Returns the number of items in the specified collection.

Creator

Returns a 32-bit integer that indicates the application in which the specified object was created.

Item[Object]

Returns an individual object in a collection.

Parent

Returns an object that represents the parent object of the specified object.

Methods

AddCallout(MsoCalloutType, Single, Single, Single, Single, Object)

Adds a borderless line callout to a document. Returns a Shape object that represents the callout and adds it to the Shapes collection.

AddCanvas(Single, Single, Single, Single, Object)

Adds a drawing canvas to a document. Returns a Shape object that represents the drawing canvas and adds it to the Shapes collection.

AddChart(XlChartType, Object, Object, Object, Object, Object)

This object, member, or enumeration is deprecated and is not intended to be used in your code.

AddChart2(Int32, XlChartType, Object, Object, Object, Object, Object, Object)

Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.

AddConnector(MsoConnectorType, Single, Single, Single, Single)

Reserved for internal use.

AddCurve(Object, Object)

Returns a Shape object that represents a Bézier curve in a document.

AddDiagram(MsoDiagramType, Single, Single, Single, Single, Object)

Returns a Shape object that represents a newly created diagram in a document.

AddLabel(MsoTextOrientation, Single, Single, Single, Single, Object)

Adds a text label to a document. Returns a Shape object that represents the text label and adds it to the Shapes collection.

AddLine(Single, Single, Single, Single, Object)

Adds a line to a document. Returns a Shape object that represents the line and adds it to the AddCallout(MsoCalloutType, Single, Single, Single, Single, Object) collection.

AddOLEControl(Object, Object, Object, Object, Object, Object)

Creates an ActiveX control (formerly known as an OLE control). Returns the Shape object that represents the new ActiveX control.

AddOLEObject(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Creates an OLE object. Returns the Shape object that represents the new OLE object.

AddPicture(String, Object, Object, Object, Object, Object, Object, Object)

Adds a picture to a document. Returns a Shape object that represents the picture and adds it to the Shapes collection.

AddPolyline(Object, Object)

Adds an open or closed polygon to a document. Returns a Shape object that represents the polygon and adds it to the Shapes collection.

AddShape(Int32, Single, Single, Single, Single, Object)

Adds an AutoShape to a document. Returns a Shape object that represents the AutoShape and adds it to the Shapes collection.

AddSmartArt(SmartArtLayout, Object, Object, Object, Object, Object)

Inserts the specified SmartArt graphic into the active document.

AddTextbox(MsoTextOrientation, Single, Single, Single, Single, Object)

Adds a text box to a document. Returns a Shape object that represents the text box and adds it to the Shapes collection.

AddTextEffect(MsoPresetTextEffect, String, String, Single, MsoTriState, MsoTriState, Single, Single, Object)

Adds a WordArt shape to a document. Returns a Shape object that represents the WordArt and adds it to the Shapes collection.

AddWebVideo(String, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Adds a new web video to the document.

BuildFreeform(MsoEditingType, Single, Single)

Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built.

GetEnumerator()
Range(Object)

Returns a ShapeRange object.

SelectAll()

Selects all the shapes in the main story, in a canvas, or in headers and footers of a document.

Applies to