NativeExcel for .Net Developer's Reference

IShapes Interface

Represents the collection of shapes. Each shape is represented by an IShape interface.

For a list of all members of this type, see IShapes Members.

[Visual Basic]


Use the IWorksheet.Shapes property to return the IShapes collection for the specified sheet.

Use Shapes[index], where index is the shape's index number (one based), to return a single IShape interface.

The following example sets the width for shape one on worksheet one.

book.Worksheets[1].Shapes[1].Width = 90;
The following example demonstrates how to access each shape on worksheet.
IWorksheet sheet = book.Worksheets[1];
int cnt = sheet.Shapes.Count;
for (int i = 1; i <= cnt; i++) 
    IShape shape = sheet.Shapes[i];
    //do something with shape 
The following example adds the shape with JPEG picture on worksheet one.
IWorksheet sheet = book.Worksheets[1];
sheet.Cells[3,3].Select(); //the upper-left corner of the shape

Use the Delete method to remove shape from a collection. The following example deletes first shape from Shapes collection on sheet one.



Namespace: NativeExcel

Assembly: NativeExcel (in NativeExcel.dll)

See Also

IShapes Members | NativeExcel Namespace