[]
Represents an object in the drawing layer, such as an AutoShape, chart, connector, or picture.
An IShape is a member of the IShapes collection and provides the common
shape API for positioning, sizing, grouping, formatting, and accessing specialized shape
features such as charts, controls, and connectors.
public interface IShape : IContainer
Public Interface IShape
Inherits IContainer
IShape shape = worksheet.Shapes.AddShape(AutoShapeType.Rectangle, 10, 10, 120, 60);
shape.Name = "SalesBox";
shape.Rotation = 15;
| Name | Description |
|---|---|
| Adjustments | Returns a collection of adjustment values for the specified AutoShape or connector. Adjustment values control editable geometry points for shapes that support adjustments. The available adjustment points depend on the current shape type. |
| AlternativeText | Gets or sets the descriptive (alternative) text string for the specified shape object. Setting a non-empty alternative text clears the decorative flag for the shape. |
| AutoShapeType | Gets or sets the auto shape type of the specified IShape object. This property applies to shape objects that support auto shape geometry. |
| BottomRightCell | Gets the IRange object that represents the cell that lies under the lower-right corner of the object. This property can be used to determine which worksheet cell is covered by the shape's lower-right corner. |
| Chart | Returns an object that represents the IChart contained in this shape. |
| Connector | Returns whether the specified shape is a connector. Use this property to determine whether connector-specific APIs such as ConnectorFormat apply to the shape. |
| ConnectorFormat | Returns the IConnectorFormat object that contains connector formatting properties. Applies to IShape objects that represent connectors. |
| Control | Gets the associated control. |
| Decorative | Gets or sets the decorative flag for the specified shape object. Setting this property to true marks the shape as decorative and clears the shape's AlternativeText and Title. |
| Fill | Returns the IFillFormat object that contains fill formatting properties for the specified chart or shape. Use the returned IFillFormat object to configure fill settings such as solid fill, gradient fill, pattern, texture, color, and transparency. |
| Formula | Gets or sets the formula of the current shape. |
| GroupItems | Gets the IGroupShapes object that represents the individual shapes in the specified group. Use the indexers of IGroupShapes to return a single shape from the group. |
| HasChart | Returns information if the IShape contains a chart. Use this property to determine whether Chart can be used to access a chart contained in the shape. |
| Hyperlink | Returns a IHyperlink object that represents the hyperlink for the shape. Use this property to access the hyperlink attached to the shape and inspect or update properties such as its address, subaddress, screen tip, or display text. |
| IsPrintable | Gets or sets whether the object should be printed. This property indicates whether the shape is included when the worksheet is printed or exported to a printable output such as PDF. |
| Line | Returns the ILineFormat object that contains line formatting properties for the specified shape. Use the returned object to access and modify the shape's line appearance, such as weight, dash style, color, and transparency. |
| Locked | Gets or sets whether the object is locked.
Returns |
| Name | Gets or sets the name of the object. Use this property to get or change the current name assigned to the shape. |
| Parent | Returns the shape's parent sheet. Returns the IWorksheet that contains this shape. |
| ParentGroup | Returns the IShape object that represents the common parent shape of a child shape or a range of child shapes. |
| PictureFormat | Returns the IPictureFormat object that contains picture formatting for the specified shape. Use the returned object to access picture-specific settings such as transparency, brightness, contrast, and cropping. |
| Placement | Gets or sets the way the object is attached to the cells below it. The returned value indicates whether the shape moves and sizes with cells, moves with cells only, or remains free floating. |
| Rotation | Gets or sets the rotation of the shape in degrees. Use this property to get or change the current rotation angle applied to the shape. |
| TextFrame | Returns the ITextFrame object that contains the text and font style properties for the specified shape. Use the returned text frame to access and modify the shape's text content, font formatting, and text layout settings. |
| ThreeD | Returns the IThreeDFormat object that contains 3-D effect formatting properties for the specified shape. Use the returned object to read or modify settings such as extrusion depth, rotation, perspective, and 3-D visibility for the shape. |
| Title | Gets or sets the title of the alternative text associated with the specified shape. |
| TopLeftCell | Returns the IRange object that represents the cell that lies under the upper-left corner of the specified object. Use this property to identify the worksheet cell beneath the shape's upper-left corner. |
| Type | Returns the shape type. Use this property to determine the general category of the shape, such as preset shape (AutoShape), Chart, Picture, TextBox, or Line. |
| Visible | Gets or sets whether the object is visible. This property indicates whether the shape is displayed on the worksheet. |
| ZOrderPosition | Returns the position of the specified shape in the z-order. Use this property to retrieve the current stacking position of a shape relative to other shapes in the same worksheet. This is typically used after calling ZOrder(ZOrderType) to inspect the updated order. |
| Name | Description |
|---|---|
| Delete() | Deletes the object. Use this method to remove a shape object from the worksheet drawing layer. |
| Duplicate() | Duplicates the shape and returns a reference to the new copy. |
| FromJson(string) | Loads the shape from the specified JSON string. Use ToJson() to generate a JSON string for a shape and apply it to another shape with this method. |
| ToImage(Stream, ImageType) | Saves the shape to the specified image stream.
Use |
| ToImage(Stream, ImageType, ImageSaveOptions) | Saves the shape to the specified image stream using options. Use this method to export the current shape as an image in the specified format. The generated image is written to the provided Stream. |
| ToImage(string) | Saves the shape to the specified image file. The generated image displays the rectangular worksheet area enclosed by the shape. This method can be used with shapes such as AutoShapes, pictures, slicers, and charts. |
| ToImage(string, ImageSaveOptions) | Saves the shape to the specified image file using options.
The generated image displays the rectangular worksheet area enclosed by the shape.
This method can be used with shapes such as AutoShapes, pictures, slicers, and charts.
Use |
| ToJson() | Generates a JSON string from the shape. The returned JSON can be used with FromJson(string) to create a shape from the serialized shape definition. |
| Ungroup() | Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes. |
| ZOrder(ZOrderType) | Moves the specified shape in front of or behind other shapes in the collection. Use ZOrderPosition to determine the current z-order position of a shape. If the z-order of a shape is changed, the index of the shape in the worksheet's shapes collection also changes. |