ShapeCollection

ShapeCollection class

Represents all the shape in a worksheet/chart.

public class ShapeCollection : CollectionBase<Shape>

Properties

Name Description
Capacity { get; set; }
Count { get; }
Item { get; } Gets the shape object at the specific index. (2 indexers)
Item { get; set; }

Methods

Name Description
AddActiveXControl(ControlType, int, int, int, int, int, int) Creates an Activex Control.
AddArc(int, int, int, int, int, int) Adds a ArcShape to the worksheet.
AddAutoShape(AutoShapeType, int, int, int, int, int, int) Adds a AutoShape to the worksheet.
AddAutoShapeInChart(AutoShapeType, int, int, int, int) Adds a AutoShape to the chart.
AddButton(int, int, int, int, int, int) Adds a Button to the worksheet.
AddCheckBox(int, int, int, int, int, int) Adds a checkbox to the worksheet.
AddComboBox(int, int, int, int, int, int) Adds a ComboBox to the worksheet.
AddCopy(Shape, int, int, int, int) Adds and copy a shape to the worksheet.
AddFreeFloatingShape(MsoDrawingType, int, int, int, int, byte[], bool) Adds a free floating shape to the worksheet.Only applies for line/image shape.
AddGroupBox(int, int, int, int, int, int) Adds a GroupBox to the worksheet.
AddIcons(int, int, int, int, int, int, byte[], byte[]) Adds svg image.
AddLabel(int, int, int, int, int, int) Adds a Label to the worksheet.
AddLabelInChart(int, int, int, int) Adds a label to the chart.
AddLine(int, int, int, int, int, int) Adds a LineShape to the worksheet.
AddLinkedPicture(int, int, int, int, string) Add a linked picture.
AddListBox(int, int, int, int, int, int) Adds a ListBox to the worksheet.
AddOleObject(int, int, int, int, int, int, byte[])
AddOleObjectWithLinkedImage(int, int, int, int, string) Add a linked picture.
AddOval(int, int, int, int, int, int) Adds a Oval to the worksheet.
AddPicture(int, int, int, int, Stream) Adds a picture to the collection.
AddPicture(int, int, Stream, int, int) Adds a picture to the collection.
AddPictureInChart(int, int, Stream, int, int) Adds a picture to the chart.
AddRadioButton(int, int, int, int, int, int) Adds a RadioButton to the worksheet.
AddRectangle(int, int, int, int, int, int) Adds a RectangleShape to the worksheet.
AddScrollBar(int, int, int, int, int, int) Adds a ScrollBar to the worksheet.
AddShape(MsoDrawingType, int, int, int, int, int, int) Adds a Shape to the worksheet.
AddShapeInChart(MsoDrawingType, PlacementType, int, int, int, int) Add a shape to chart .All unit is 1/4000 of chart area.
AddShapeInChart(MsoDrawingType, PlacementType, int, int, int, int, byte[]) Add a shape to chart .All unit is 1/4000 of chart area.
AddShapeInChartByScale(MsoDrawingType, PlacementType, double, double, double, double) Add a shape to chart. All unit is percent scale of chart area.
AddShapeInChartByScale(MsoDrawingType, PlacementType, double, double, double, double, byte[]) Add a shape to chart .All unit is 1/4000 of chart area.
AddSpinner(int, int, int, int, int, int) Adds a Spinner to the worksheet.
AddSvg(int, int, int, int, int, int, byte[], byte[]) Adds svg image.
AddTextBox(int, int, int, int, int, int) Adds a text box to the worksheet.
AddTextBoxInChart(int, int, int, int) Adds a textbox to the chart.
AddTextEffect(MsoPresetTextEffect, string, string, int, bool, bool, int, int, int, int, int, int) Inserts a WordArt object.
AddTextEffectInChart(MsoPresetTextEffect, string, string, int, bool, bool, int, int, int, int) Inserts a WordArt object to the chart
AddWordArt(PresetWordArtStyle, string, int, int, int, int, int, int) Adds preset WordArt since Excel 2007.s
BinarySearch(Shape)
BinarySearch(Shape, IComparer<Shape>)
BinarySearch(int, int, Shape, IComparer<Shape>)
Clear() Clear all shapes. (2 methods)
Contains(Shape)
CopyCommentsInRange(ShapeCollection, CellArea, int, int) Copy all comments in the range.
CopyInRange(ShapeCollection, CellArea, int, int, bool) Copy shapes in the range to destination range.
CopyTo(Shape[])
CopyTo(Shape[], int)
CopyTo(int, Shape[], int, int)
DeleteInRange(CellArea) Delete shapes in the range.Comment shapes will not be deleted.
DeleteShape(Shape) Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted.
Exists(Predicate<Shape>)
Find(Predicate<Shape>)
FindAll(Predicate<Shape>)
FindIndex(Predicate<Shape>)
FindIndex(int, Predicate<Shape>)
FindIndex(int, int, Predicate<Shape>)
FindLast(Predicate<Shape>)
FindLastIndex(Predicate<Shape>)
FindLastIndex(int, Predicate<Shape>)
FindLastIndex(int, int, Predicate<Shape>)
GetEnumerator()
Group(Shape[]) Group the shapes.
IndexOf(Shape)
IndexOf(Shape, int)
IndexOf(Shape, int, int)
LastIndexOf(Shape)
LastIndexOf(Shape, int)
LastIndexOf(Shape, int, int)
Remove(Shape) Remove the shape.
RemoveAt(int) Remove the shape. (2 methods)
Ungroup(GroupShape) Ungroups the shape items.
UpdateSelectedValue() Update the selected value by the value of the linked cell of the shapes.

Examples


[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//get ShapeCollection
ShapeCollection shapes = workbook.Worksheets[0].Shapes;

//do your business

//Save the excel file.
workbook.Save("result.xlsx");

See Also