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]
PublicInterfaceIShapes
[C#]
publicinterfaceIShapes
[C++]
public__gc__interfaceIShapes
[JScript]
publicinterfaceIShapes

Remarks

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.

[C#]
book.Worksheets[1].Shapes[1].Width = 90;
The following example demonstrates how to access each shape on worksheet.
[C#]
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.
[C#]
IWorksheet sheet = book.Worksheets[1];
sheet.Cells[3,3].Select(); //the upper-left corner of the shape
sheet.Shapes.AddPicture("image.jpg");

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

[C#]
book.Worksheets[1].Sheets[1].Delete();

Requirements

Namespace: NativeExcel

Assembly: NativeExcel (in NativeExcel.dll)

See Also

IShapes Members | NativeExcel Namespace