共用方式為


DocumentBase.Shapes Property

Definition

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

public:
 property Microsoft::Office::Interop::Word::Shapes ^ Shapes { Microsoft::Office::Interop::Word::Shapes ^ get(); };
public Microsoft.Office.Interop.Word.Shapes Shapes { get; }
member this.Shapes : Microsoft.Office.Interop.Word.Shapes
Public ReadOnly Property Shapes As Shapes

Property Value

A Shapes collection that represents all the Shape objects 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 void DocumentShapes()
{
    this.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationVertical,
        10, 10, 50, 50, ref missing);
}
Private Sub DocumentShapes()
    Me.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation. _
        msoTextOrientationVertical, 10, 10, 50, 50)
End Sub 

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.

Applies to