Partager via


DocumentBase.Shapes Property

Gets a Shapes collection that represents all the Shape objects in the document.s

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property Shapes As Shapes
public Shapes Shapes { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Shapes
A Shapes collection that represents all the Shape objects in the document.

Remarks

This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.

The Shapes property, when applied to a document, returns all the Shape objects in the main story of the document, excluding the headers and footers. When applied to a HeaderFooter object, the Shapes property returns all the Shape objects found in all the headers and footers in the document.

Examples

The following code example adds a shape to the upper left-hand corner of the document. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentShapes()
    Me.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation. _
        msoTextOrientationVertical, 10, 10, 50, 50)
End Sub
private void DocumentShapes()
{
    this.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationVertical,
        10, 10, 50, 50, ref missing);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace