Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Collapse]Spreadsheet Document
     Workbook
     Worksheets
     Cells and Cell Ranges
     Rows and Columns
     Shapes, Pictures, Charts
     Comments
     Measure Units
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[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.

Note

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

Expanded Location

A shape position in a worksheet is determined by the following properties.

Property

Description

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

The picture below displays an image which has B3 as its top left cell, C6 as its bottom right cell. Left, Top, X- and Y-Offsets are indicated in the picture.

Use the FloatingObject.Move method to change the location.

Expanded Size and Rotation

A shape can be freely resized and rotated.

Utilize the FloatingObject.Height and FloatingObject.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 FloatingObject.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.

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