officefileapi-devexpress-dot-spreadsheet-dot-shapecollection-dot-getshapesbyname-x28-system-dot-string-x29.md
Gets a drawing object(s) by name.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
IList<Shape> GetShapesByName(
string shapeName
)
Function GetShapesByName(
shapeName As String
) As IList(Of Shape)
| Name | Type | Description |
|---|---|---|
| shapeName | String |
A string that is the name of a drawing object.
|
| Type | Description |
|---|---|
| IList<Shape> |
A collection of drawing objects with the same name.
|
A drawing object name is specified by the Shape.Name property. A worksheet may contain more than one drawing object with the same name. In this situation, the IList<T><Shape,> collection returned by the GetShapesByName method contains several items.
If a drawing object with the specified name is not found, the method returns an empty list.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetShapesByName(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
// Find the shape by its name. The method returns a collection of shapes with the same name.
Shape picShape = worksheet.Shapes.GetShapesByName("Picture 4")[0];
picShape.Delete();
' Find the shape by its name. The method returns a collection of shapes with the same name.
Dim picShape As Shape = worksheet.Shapes.GetShapesByName("Picture 4")(0)
picShape.Delete()
See Also