Back to Devexpress

Shape Interface

officefileapi-devexpress-dot-spreadsheet-3d5ad339.md

latest6.2 KB
Original Source

Shape Interface

A common interface for drawing objects in a worksheet.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public interface Shape :
    FloatingObject,
    ShapeFormatBase
vb
Public Interface Shape
    Inherits FloatingObject,
             ShapeFormatBase

The following members return Shape objects:

Show 14 links

LibraryRelated API Members
WinForms ControlsSpreadsheetControl.SelectedShape
WPF ControlsSpreadsheetControl.SelectedShape
Office File APIShape.ParentGroup
ShapeCollection.AddConnector(ConnectorType, Single, Single, Single, Single)
ShapeCollection.AddShape(ShapeGeometryPreset, Cell, Single, Single)
ShapeCollection.AddShape(ShapeGeometryPreset, CellRange)
ShapeCollection.AddShape(ShapeGeometryPreset, Single, Single, Single, Single)
ShapeCollection.AddTextBox(Cell, Single, Single, String)
ShapeCollection.AddTextBox(CellRange, String)
ShapeCollection.AddTextBox(Single, Single, Single, Single, String)
ShapeCollection.GetShapeById(Int32)
ShapeCollection.GroupShapes(IList<Shape>)
ShapeText.Shape
Worksheet.SelectedShape

Remarks

The Worksheet.Shapes property returns the ShapeCollection containing all Shape objects in a worksheet. You can get a drawing object by its ID or name using the ShapeCollection.GetShapeById or ShapeCollection.GetShapesByName method, respectively.

The table below lists the supported drawing object types and methods used to create them:

Drawing ObjectMethod
ShapeShapeCollection.AddShape
Shape GroupShapeCollection.GroupShapes
Text BoxShapeCollection.AddTextBox
Shape ConnectorShapeCollection.AddConnector
PicturePictureCollection.AddPicture
ChartChartCollection.Add

The drawing object’s position can be determined using the FloatingObject.Top and FloatingObject.Left properties, which get the distance from the top and left edges of the worksheet. You can also use the FloatingObject.TopLeftCell property to determine the cell under the top left corner of the drawing object, and then get the FloatingObject.OffsetX and FloatingObject.OffsetY values to determine the position of the object’s top left corner within that cell.

You can freely move and rotate a drawing object using the FloatingObject.Move and Shape.IncrementRotation methods.

To delete a drawing object, use the ShapeCollection.RemoveAt or Shape.Delete method.

See Also

Shape Members

Charts and Graphics in Spreadsheet Documents

DevExpress.Spreadsheet Namespace