Log In
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler (new)
    Product Structure
   [Expand]Getting Started
   [Collapse]Spreadsheet Document
     Cell and Cell Range
     Rows and Columns
     Shapes, Pictures, Charts
    Supported Formats
   [Expand]Cell Basics
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
    Find and Replace
   [Expand]Visual Elements
    Themes and Templates
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Shapes, Pictures, Charts

A worksheet may contain embedded drawing objects. A drawing object belongs to the base Shape class. An image in a worksheet is a drawing object that belongs to the Picture class, which implements the Shape interface. An embedded chart is an object of the Chart type which also implements the Shape interface. Thus, all these objects have common properties and methods inherited from the base Shape interface, listed below.


Not all methods and properties of the base Shape interface are in effect for pictures and charts.

Expanded Location

A picture position in a worksheet is determined by the following properties:



Shape.Left Gets or sets the distance from the left edge of the worksheet to the top left corner of the shape.
Shape.OffsetX Gets a distance from the top left corner of the shape to the left edge of the cell where the top left corner of the shape is located.
Shape.Top Gets or sets the distance from the top edge of the worksheet to the top left corner of the shape.
Shape.OffsetY Gets a distance from the top left corner of the shape to the top edge of the cell where the top left corner of the shape is located.
Shape.TopLeftCell Gets a cell where the top left corner of a shape is located.
Shape.BottomRightCell Gets a cell where the bottom right corner of a shape is located.
Shape.ZOrderPosition Gets the position of the current shape in the z-order.

The picture below shows an image whose top left cell is B3 and bottom right cell is C6. The Left, Top, X- and Y-Offsets are indicated in the picture.

Use the Shape.Move method to change the location.

Expanded Size and Rotation

A shape can be freely resized and rotated.

Utilize the Shape.Height and Shape.Width to specify the shape size. If the Shape.LockAspectRatio option is set to true, the modification of one property results in another property being changed to retain the aspect ratio.

Use the Shape.Rotation property to set the angle to which a shape is rotated, and use the Shape.IncrementRotation method to rotate the shape by a specified number of degrees.

An end-user can resize or rotate a shape with special handles, which are visible for a selected shape.

Expanded Placement

A shape may respond when cells underneath it are moved or resized. Shape behavior is determined by the Shape.Placement property. A shape can be moved and resized with cells, or it can float freely.

When a shape is added to a worksheet, the initial placement depends on the specific overload of the ShapeCollection.AddPicture method. If a Cell is passed to the method, the shape will move with cells. If a Range is passed to the method, the shape will move and size with cells. If coordinates are specified when an image is inserted in a worksheet, a shape will float freely.

To move a shape in front of or behind other shapes in a worksheet, specify its Shape.ZOrderPosition property relative to other shapes. When shapes are added to the Worksheet.Shapes collection, the ZOrderPosition gets its value incremented by one starting from 1. You can increase the ZOrderPosition property value to move the shape in front of all shapes with lower ZOrderPosition. The ShapeCollection.NormalizeZOrder method modifies ZOrderPosition values for all shapes in a collection, so that they become a series of consecutive integers starting from 1.

Expanded Hyperlink

A hyperlink can be associated with a shape. When the end-user clicks the picture, the link navigates to a certain location on the Internet, to a file, to a place in a workbook, or it sends an email. Use the Shape.InsertHyperlink method to create a hyperlink for the picture. Use the Shape.RemoveHyperlink method to delete a hyperlink.

Expanded See Also

How would you rate this topic?​​​​​​​