[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Expand]Document Structure
    [Collapse]Document Elements
      Positions and Ranges
      Inline Pictures
      Text Boxes
      Hyperlinks and Bookmarks
      Headers and Footers
      Range Permissions
      Document Properties
     Measure Units
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Spell Checking
    AutoCorrect Feature
    Track Changes
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    Keyboard Shortcuts
    HTML Tag Support
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Inline Pictures


Refer to the Shapes article for information on new pictures and shapes.

Expanded Pictures in the User Interface

End users can use the Insert ribbon tab to insert pictures in a document. Click Pictures button to invoke the browser dialog and select target image files.

When image is selected, the Picture Tools | Format contextual tab becomes available. This tab allows you to change the image's position, text wrapping, and outline options. The inline image has In line with Text wrapping style.


If you you work with documents created in a Microsoft Word version earlier than 2007, its inline images do not have additional UI elements.

Right-click an image and select More Layout Options... to invoke the Shape Layout Dialog. This dialog allows end users to specify advanced drawing object's properties.

Expanded Pictures in Code

Insert an Image

All images in the document are contained in two collections: DocumentImageCollection (accessible by the SubDocument.Images property) and ShapeCollection (see ShapeCollection) (accessible by the SubDocument.Shapes property).

Call the DocumentImageCollection.Append or DocumentImageCollection.Insert method to place an inline image in the document. The resulting object is also added to the ShapeCollection (see ShapeCollection).

The RichEditControl supports the following graphic 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)

When you work with documents created in a Microsoft Word version earlier than 2007, its inline pictures are stored in the DocumentImageCollection only.

Resize an Image

The following properties allow you to resize an inline image:




Gets or sets the X-axis scale factor.


Gets or sets the Y-axis scale factor.


Specifies the picture's size in current measurement units (specified by the Document.Unit property).

The following example examines all images in the document. If the width of an image exceeds 50 millimeters, the image is scaled proportionally to half its size.

Obtain Image Information

The DocumentImage.Image property enables you to get information on image size, resolution and color depth. The returned OfficeImage object can be used to get a native .NET System.Drawing.Image (the OfficeImage.NativeImage property) or to get image data in a different format (the OfficeImage.GetImageBytes method).

The code sample below retrieves all images in the document and saves them as separate files.

To save an image from the document to a file, use the ReadOnlyDocumentImageCollection.Get method to obtain a collection of images within the specified range, and use the OfficeImage.NativeImage property, which allows access to a native System.Drawing.Image object. This object has the Save method that accomplishes the task.


Use the ReadOnlyDocumentImageCollection.Get method to get images from the specified range (see DocumentRange).

Delete an Image

Clear the range occupied by the image to delete this image from the document. The DocumentImage.Range property returns the related range.

Export Specifics


Use the RtfDocumentExporterCompatibilityOptions.DuplicateObjectAsMetafile property to specify whether to save inline pictures in the native format and as metafiles.


Handle the RichEditControl.BeforeExport event and specify the HtmlDocumentExporterOptions.UriExportType and IExporterOptions.TargetUri properties to specify a location for storing images as external files.

Create custom IUriProvider interface implementation and specify it instead of the default URI provider in the SubDocument.GetHtmlText method to create custom css and image URIs.


A complete sample project is available at How to save the document range in different formats repository on GitHub.

The Document.HtmlText method uses a special URI provider (the DataStringUriProvider), which converts an image to a base64-encoded representation with the "data:" prefix. If you use the Document.HtmlText method to obtain the HTML content, all images are embedded in the page.

Expanded See Also

Is this topic helpful?​​​​​​​