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)

public Shapes Shapes { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Shapes

A Shapes collection that represents all the Shape objects in the document.

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 T:Microsoft.Office.Interop.Word.HeaderFooter object, the Shapes property returns all the Shape objects found in all the headers and footers in the document.

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 void DocumentShapes()
{
    this.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationVertical,
        10, 10, 50, 50, ref missing);
}
Return to top
Show: