Page tree
Skip to end of metadata
Go to start of metadata

Description

The Shape class allows the appearance and behavior of drawing object to be manipulated. On its own, Shape represents a simple auto shape, such as a line, rectangle, or oval. A shape may also represent the display area of a Comment or the size, position, and formatting of a Picture.

C#
vb.net

Remarks

Once a Shape is created with a particular ShapeType, the type may not be changed. Instead, delete the shape and create a new one with the appropriate type.

To create a Shape object, call Shapes.CreateShape.

Properties

Name

Description

FillColor

Sets or returns the shape's fill color. The color may be either a custom color or a palette color.

FillTransparency

Sets or returns the fill transparency the shape as a real number value between 0 (opaque) and 1 (transparent).

FitToText

Sets or returns whether the shape will be automatically sized to fit the text.

Height

Sets or returns the height of the Shape.

HorizontalAlignment

Sets or returns the horizontal alignment of text within the shape.

LineColor

Sets or returns the Shape 's line color.

LockAspectRatio

Sets or returns whether the aspect ratio of the shape will be locked in Excel. This setting has no effect within ExcelWriter.

Name

Returns the name associated with this shape.

ObjectPositioning

Sets or returns the ObjectPositioning value that determines the shape's resize and reposition behavior when the cells in the worksheet are changed.

Position

Sets or returns the Shape's position in the worksheet. This property determines the location of the shape's upper left corner.

Rotation

Sets or returns the rotation angle of the shape.

Text

Sets or returns the text displayed within the shape.

Type

Returns the Shape object's type. This property may not be changed.

VerticalAlignment

Sets or returns the vertical alignment of text within the shape.

Width

Sets or returns the width of the Shape.

Properties

Methods

Name

Description

ClearRichTextFormatting()

Clears all rich text formatting within the shape. The font of the shape will be set to the normal font of the workbook.

GetCharacters(Int32)

Returns a CharacterRun object representing a range of characters within the comment text. Use this to set the font on specified characters within the text.

GetCharacters(Int32, Int32)

Returns a CharacterRun object representing a range of characters within the comment text. Use this to set the font on specified characters within the text.

SetCustomFillColor(Int32, Int32, Int32)

Sets the fill color for the shape to be the specified custom RGB value, and returns the generated Color. This method allows a shape to have a color not defined in the worksheet's Palette.

SetCustomLineColor(Int32, Int32, Int32)

Sets the line color for the shape to be the specified custom RGB value, and returns the generated Color. This method allows a shape to have a line color not defined in the worksheet's Palette.

 

  • No labels