All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ShapeCollection.InsertShape(DocumentPosition, ShapeGeometryPreset) Method

Inserts a shape in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v21.1.Core.dll

Declaration

Shape InsertShape(
    DocumentPosition pos,
    ShapeGeometryPreset preset
)

Parameters

Name Type Description
pos DocumentPosition

The position of the shape’s anchor.

preset ShapeGeometryPreset

An enumeration member that defines the shape’s geometry.

Returns

Type Description
Shape

The shape embedded in the document.

Remarks

The InsertShape method adds a shape to the page that contains the shape’s anchor and sets its position as follows:

  • the absolute horizontal position to the right of the column is 0;

  • the absolute vertical position below the paragraph is 0.

Use the following properties to customize shape appearance:

  • Shape.Fill - Allows you to specify shape fill options.

  • Shape.Line - Provides access to format settings for the shape outline.

The example below creates and formats a simple shape.

Rich_InsertShape

Document document = wordProcessor.Document;
// Create a shape.
Shape shape = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Explosion1);
// Fill the shape with color.
shape.Fill.SetSolidFill(Color.FromArgb(0xFF, 0xEE, 0xAD));
// Format the shape border.
ShapeLine border = shape.Line;
border.Color = Color.FromArgb(0x4D, 0x64, 0x8D);
border.Thickness = 3;
See Also