ShapeCollection.InsertPicture(DocumentPosition, DocumentImageSource) Method
Inserts a picture in the document.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v26.1.Core.dll
NuGet Package: DevExpress.RichEdit.Core
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| pos | DocumentPosition | The position of the picture’s anchor. |
| imageSource | DocumentImageSource | An object that specifies the image source. |
Returns
| Type | Description |
|---|---|
| Shape | The picture embedded in the document. |
Remarks
The InsertPicture method positions a floating picture at the top-left corner of the page that contains the picture’s anchor. The TextWrapping property is set to InFrontOfText.
The following image formats are available:
- 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)
- Scalable Vector Graphics (*.svg)
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),
DocumentImageSource.FromFile("Documents\\beverages.png"));
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.Center;
See Also