.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ShapeCollection.InsertPicture(DocumentPosition, Image) Method

Inserts a picture in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

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


Shape InsertPicture(
    DocumentPosition pos,
    Image image


Name Type Description
pos DocumentPosition

The position of the picture’s anchor.

image Image

The image to insert.


Type Description

The picture embedded in the document.


The InsertPicture method positions a floating picture at the beginning of the page that contains the picture’s anchor.

The Word Processing Document API and Rich Text Editors support the following image types:

  • Bitmap (*.bmp, *.dib)
  • JPEG File Interchange Format (*.jpg, *.jpeg)
  • Portable Network Graphics (*.png)
  • Graphics Interchange Format (*.gif)
  • Tagged Image Format (*.tif, *.tiff)
  • Microsoft Enhanced Metafile (*.emf)
  • Windows Metafile (*.wmf)

The example below inserts a picture and specifies its horizontal alignment.

Document document = wordProcessor.Document;
document.AppendText("Line One\nLine Two\nLine Three");
Shape myPicture = document.Shapes.InsertPicture(document.CreatePosition(15),
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.Center;
See Also