A newer version of this page is available. Switch to the current version.

How to: Create a Shape

This example describes how to create a shape and change its form, size, and rotation angle.

Create a Shape

The code sample below illustrates how to use the ShapeCollection.AddShape method to create a shape.


Worksheet worksheet = spreadsheetControl1.Document.Worksheets[0];
Shape shape = worksheet.Shapes.AddShape(ShapeGeometryPreset.RectangularCallout, 100, 100, 500, 500);

Change a Shape’s Form

Use the ShapeGeometry.Preset property to change the drawing object’s geometry type. The code sample below shows how to modify a callout to an End action button.


shape.ShapeGeometry.Preset = ShapeGeometryPreset.ActionButtonEnd;

Resize and Rotate a Shape

Use the following properties to rotate and resize a shape similarly to what appears on the image below.

shape.Rotation = 45;
shape.Width = 300;
shape.Height = 300;



You can provide a text for a shape. Refer to the How to: Add Text to a Shape topic for more information.

See Also