## ShapeCollection class

Represents all the shape in a worksheet/chart.

```csharp
public class ShapeCollection : CollectionBase<Shape>
```

## Properties

| Name | Description |
| --- | --- |
| [Capacity](../../aspose.cells/collectionbase-1/capacity/) { get; set; } |  |
| [Count](../../aspose.cells/collectionbase-1/count/) { get; } |  |
| [Item](../../aspose.cells.drawing/shapecollection/item/) { get; } | Gets the [`Shape`](../shape/) object at the specific index in the list. (2 indexers) |
| [Item](../../aspose.cells/collectionbase-1/item/) { get; set; } |  |

## Methods

| Name | Description |
| --- | --- |
| [AddActiveXControl](../../aspose.cells.drawing/shapecollection/addactivexcontrol/)(ControlType, int, int, int, int, int, int) | Creates an Activex Control. |
| [AddArc](../../aspose.cells.drawing/shapecollection/addarc/)(int, int, int, int, int, int) | Adds a ArcShape to the worksheet. |
| [AddAutoShape](../../aspose.cells.drawing/shapecollection/addautoshape/)(AutoShapeType, int, int, int, int, int, int) | Adds a AutoShape to the worksheet. |
| [AddAutoShapeInChart](../../aspose.cells.drawing/shapecollection/addautoshapeinchart/)(AutoShapeType, int, int, int, int) | Adds a AutoShape to the chart. |
| [AddButton](../../aspose.cells.drawing/shapecollection/addbutton/)(int, int, int, int, int, int) | Adds a Button to the worksheet. |
| [AddCheckBox](../../aspose.cells.drawing/shapecollection/addcheckbox/)(int, int, int, int, int, int) | Adds a checkbox to the worksheet. |
| [AddComboBox](../../aspose.cells.drawing/shapecollection/addcombobox/)(int, int, int, int, int, int) | Adds a ComboBox to the worksheet. |
| [AddCopy](../../aspose.cells.drawing/shapecollection/addcopy/#addcopy)(Shape, int, int, int, int) | Adds and copy a shape to the worksheet. |
| [AddCopy](../../aspose.cells.drawing/shapecollection/addcopy/#addcopy_1)(Shape, int, int, int, int, CopyOptions) | Adds and copy a shape to the worksheet. |
| [AddEquation](../../aspose.cells.drawing/shapecollection/addequation/)(int, int, int, int, int, int) | Adds an equation object to the worksheet. |
| [AddFreeFloatingShape](../../aspose.cells.drawing/shapecollection/addfreefloatingshape/)(MsoDrawingType, int, int, int, int, byte[], bool) | Adds a free floating shape to the worksheet.Only applies for line/image shape. |
| [AddFreeform](../../aspose.cells.drawing/shapecollection/addfreeform/)(int, int, int, int, int, int, ShapePath[]) | Adds a freeform shape to the worksheet. |
| [AddGroupBox](../../aspose.cells.drawing/shapecollection/addgroupbox/)(int, int, int, int, int, int) | Adds a GroupBox to the worksheet. |
| [AddIcons](../../aspose.cells.drawing/shapecollection/addicons/)(int, int, int, int, int, int, byte[], byte[]) | Adds svg image. |
| [AddLabel](../../aspose.cells.drawing/shapecollection/addlabel/)(int, int, int, int, int, int) | Adds a Label to the worksheet. |
| [AddLabelInChart](../../aspose.cells.drawing/shapecollection/addlabelinchart/)(int, int, int, int) | Adds a label to the chart. |
| [AddLaTeXEquation](../../aspose.cells.drawing/shapecollection/addlatexequation/)(int, int, int, int, int, int, string) | Adds an equation object to the worksheet using LaTeX format strings. |
| [AddLine](../../aspose.cells.drawing/shapecollection/addline/)(int, int, int, int, int, int) | Adds a LineShape to the worksheet. |
| [AddLinkedPicture](../../aspose.cells.drawing/shapecollection/addlinkedpicture/)(int, int, int, int, string) | Add a linked picture. |
| [AddListBox](../../aspose.cells.drawing/shapecollection/addlistbox/)(int, int, int, int, int, int) | Adds a ListBox to the worksheet. |
| [AddOleObject](../../aspose.cells.drawing/shapecollection/addoleobject/)(int, int, int, int, int, int, byte[]) | Adds an OleObject. |
| [AddOleObjectWithLinkedImage](../../aspose.cells.drawing/shapecollection/addoleobjectwithlinkedimage/)(int, int, int, int, string) | Add a linked picture. |
| [AddOval](../../aspose.cells.drawing/shapecollection/addoval/)(int, int, int, int, int, int) | Adds a Oval to the worksheet. |
| [AddPicture](../../aspose.cells.drawing/shapecollection/addpicture/#addpicture)(int, int, int, int, Stream) | Adds a picture to the collection. |
| [AddPicture](../../aspose.cells.drawing/shapecollection/addpicture/#addpicture_1)(int, int, Stream, int, int) | Adds a picture to the collection. |
| [AddPictureInChart](../../aspose.cells.drawing/shapecollection/addpictureinchart/)(int, int, Stream, int, int) | Adds a picture to the chart. |
| [AddRadioButton](../../aspose.cells.drawing/shapecollection/addradiobutton/)(int, int, int, int, int, int) | Adds a RadioButton to the worksheet. |
| [AddRectangle](../../aspose.cells.drawing/shapecollection/addrectangle/)(int, int, int, int, int, int) | Adds a RectangleShape to the worksheet. |
| [AddScrollBar](../../aspose.cells.drawing/shapecollection/addscrollbar/)(int, int, int, int, int, int) | Adds a ScrollBar to the worksheet. |
| [AddShape](../../aspose.cells.drawing/shapecollection/addshape/)(MsoDrawingType, int, int, int, int, int, int) | Adds a Shape to the worksheet. |
| [AddShapeInChart](../../aspose.cells.drawing/shapecollection/addshapeinchart/#addshapeinchart)(MsoDrawingType, PlacementType, int, int, int, int) | Add a shape to chart .All unit is 1/4000 of chart area. |
| [AddShapeInChart](../../aspose.cells.drawing/shapecollection/addshapeinchart/#addshapeinchart_1)(MsoDrawingType, PlacementType, int, int, int, int, byte[]) | Add a shape to chart .All unit is 1/4000 of chart area. |
| [AddShapeInChartByScale](../../aspose.cells.drawing/shapecollection/addshapeinchartbyscale/#addshapeinchartbyscale)(MsoDrawingType, PlacementType, double, double, double, double) | Add a shape to chart. All unit is percent scale of chart area. |
| [AddShapeInChartByScale](../../aspose.cells.drawing/shapecollection/addshapeinchartbyscale/#addshapeinchartbyscale_1)(MsoDrawingType, PlacementType, double, double, double, double, byte[]) | Add a shape to chart .All unit is 1/4000 of chart area. |
| [AddSignatureLine](../../aspose.cells.drawing/shapecollection/addsignatureline/)(int, int, SignatureLine) | Adds a Signature Line to the worksheet. |
| [AddSpinner](../../aspose.cells.drawing/shapecollection/addspinner/)(int, int, int, int, int, int) | Adds a Spinner to the worksheet. |
| [AddSvg](../../aspose.cells.drawing/shapecollection/addsvg/)(int, int, int, int, int, int, byte[], byte[]) | Adds svg image. |
| [AddTextBox](../../aspose.cells.drawing/shapecollection/addtextbox/)(int, int, int, int, int, int) | Adds a text box to the worksheet. |
| [AddTextBoxInChart](../../aspose.cells.drawing/shapecollection/addtextboxinchart/)(int, int, int, int) | Adds a textbox to the chart. |
| [AddTextEffect](../../aspose.cells.drawing/shapecollection/addtexteffect/)(MsoPresetTextEffect, string, string, int, bool, bool, int, int, int, int, int, int) | Inserts a WordArt object. |
| [AddTextEffectInChart](../../aspose.cells.drawing/shapecollection/addtexteffectinchart/)(MsoPresetTextEffect, string, string, int, bool, bool, int, int, int, int) | Inserts a WordArt object to the chart |
| [AddWordArt](../../aspose.cells.drawing/shapecollection/addwordart/)(PresetWordArtStyle, string, int, int, int, int, int, int) | Adds preset WordArt since Excel 2007.s |
| [BinarySearch](../../aspose.cells/collectionbase-1/binarysearch/)(Shape) |  |
| [BinarySearch](../../aspose.cells/collectionbase-1/binarysearch/)(Shape, IComparer&lt;Shape&gt;) |  |
| [BinarySearch](../../aspose.cells/collectionbase-1/binarysearch/)(int, int, Shape, IComparer&lt;Shape&gt;) |  |
| [Clear](../../aspose.cells.drawing/shapecollection/clear/#clear)() | Clear all shapes in the worksheet. (2 methods) |
| [Contains](../../aspose.cells/collectionbase-1/contains/)(Shape) |  |
| [CopyCommentsInRange](../../aspose.cells.drawing/shapecollection/copycommentsinrange/)(ShapeCollection, CellArea, int, int) | Copy all comments in the range. |
| [CopyInRange](../../aspose.cells.drawing/shapecollection/copyinrange/)(ShapeCollection, CellArea, int, int, bool) | Copy shapes in the range to destination range. |
| [CopyTo](../../aspose.cells/collectionbase-1/copyto/)(Shape[]) |  |
| [CopyTo](../../aspose.cells/collectionbase-1/copyto/)(Shape[], int) |  |
| [CopyTo](../../aspose.cells/collectionbase-1/copyto/)(int, Shape[], int, int) |  |
| [DeleteInRange](../../aspose.cells.drawing/shapecollection/deleteinrange/)(CellArea) | Delete shapes in the range.Comment shapes will not be deleted. |
| [DeleteShape](../../aspose.cells.drawing/shapecollection/deleteshape/)(Shape) | Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted. |
| [Exists](../../aspose.cells/collectionbase-1/exists/)(Predicate&lt;Shape&gt;) |  |
| [Find](../../aspose.cells/collectionbase-1/find/)(Predicate&lt;Shape&gt;) |  |
| [FindAll](../../aspose.cells/collectionbase-1/findall/)(Predicate&lt;Shape&gt;) |  |
| [FindIndex](../../aspose.cells/collectionbase-1/findindex/)(Predicate&lt;Shape&gt;) |  |
| [FindIndex](../../aspose.cells/collectionbase-1/findindex/)(int, Predicate&lt;Shape&gt;) |  |
| [FindIndex](../../aspose.cells/collectionbase-1/findindex/)(int, int, Predicate&lt;Shape&gt;) |  |
| [FindLast](../../aspose.cells/collectionbase-1/findlast/)(Predicate&lt;Shape&gt;) |  |
| [FindLastIndex](../../aspose.cells/collectionbase-1/findlastindex/)(Predicate&lt;Shape&gt;) |  |
| [FindLastIndex](../../aspose.cells/collectionbase-1/findlastindex/)(int, Predicate&lt;Shape&gt;) |  |
| [FindLastIndex](../../aspose.cells/collectionbase-1/findlastindex/)(int, int, Predicate&lt;Shape&gt;) |  |
| [GetEnumerator](../../aspose.cells/collectionbase-1/getenumerator/)() |  |
| [Group](../../aspose.cells.drawing/shapecollection/group/)(Shape[]) | Group the shapes. |
| [IndexOf](../../aspose.cells/collectionbase-1/indexof/)(Shape) |  |
| [IndexOf](../../aspose.cells/collectionbase-1/indexof/)(Shape, int) |  |
| [IndexOf](../../aspose.cells/collectionbase-1/indexof/)(Shape, int, int) |  |
| [LastIndexOf](../../aspose.cells/collectionbase-1/lastindexof/)(Shape) |  |
| [LastIndexOf](../../aspose.cells/collectionbase-1/lastindexof/)(Shape, int) |  |
| [LastIndexOf](../../aspose.cells/collectionbase-1/lastindexof/)(Shape, int, int) |  |
| [Remove](../../aspose.cells.drawing/shapecollection/remove/)(Shape) | Remove the shape. |
| [RemoveAt](../../aspose.cells.drawing/shapecollection/removeat/#removeat)(int) | Remove the shape. (2 methods) |
| [Ungroup](../../aspose.cells.drawing/shapecollection/ungroup/)(GroupShape) | Ungroups the shape items. |
| [UpdateSelectedValue](../../aspose.cells.drawing/shapecollection/updateselectedvalue/)() | Update the selected value by the value of the linked cell or range of the shape. |

### Examples

```csharp
namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Drawing;
    using System;
    using System.IO;

    public class ShapeCollectionDemo
    {
        public static void ShapeCollectionExample()
        {
            // Instantiating a Workbook object
            Workbook workbook = new Workbook();

            // Get the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Get the ShapeCollection from the worksheet
            ShapeCollection shapes = worksheet.Shapes;

            // Add a rectangle shape to the worksheet
            int upperLeftRow = 2;
            int top = 0;
            int upperLeftColumn = 2;
            int left = 0;
            int height = 100;
            int width = 200;
            shapes.AddRectangle(upperLeftRow, top, upperLeftColumn, left, height, width);

            // Add a textbox to the worksheet
            shapes.AddTextBox(upperLeftRow, top, upperLeftColumn + 5, left, height, width);

            // Add a picture to the worksheet
            using (FileStream fs = new FileStream("example.jpg", FileMode.Open, FileAccess.Read))
            {
                shapes.AddPicture(upperLeftRow + 7, upperLeftColumn, fs, 100, 100);
            }

            // Add a button to the worksheet
            shapes.AddButton(upperLeftRow + 12, top, upperLeftColumn, left, height, width);

            // Save the workbook
            workbook.Save("ShapeCollectionExample.xlsx");
        }
    }
}
```

### See Also

* class [CollectionBase&lt;T&gt;](../../aspose.cells/collectionbase-1/)
* class [Shape](../shape/)
* namespace [Aspose.Cells.Drawing](../../aspose.cells.drawing/)
* assembly [Aspose.Cells](../../)


