[Expand]General Information
[Collapse]WinForms Controls
 [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]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
      Hyperlinks and Bookmarks
      Headers and Footers
      Range Permissions
      Numbered and Bulleted Lists
      Text Boxes
      Document Properties
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Spell Checking
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
   [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

RichEditControl allows inserting pictures into a document as inline images or floating objects.


This document describes inline pictures. For information about floating pictures, refer to the Shapes article.

Expanded Overview

An inline picture in a document is represented by the DocumentImage object. It occupies the range equivalent to one character, i.e., the DocumentRange.Length of the range is equal to 1.

The DocumentImage.Image property provides access to the previous level of image abstraction, and enables you to get information on image size, resolution and color depth. The OfficeImage object obtained via this property 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).

All images in the document are contained in the DocumentImageCollection accessible using the SubDocument.Images property. Use the DocumentImageCollection.Insert and DocumentImageCollection.Append methods to insert pictures into a document.

End-users can execute the InsertPictureCommand command. The corresponding button is located in the Insert Pages - Illustrations Ribbon page group. Change the picture's Text Wrapping option (located on the Picture Tools contextual tab) to In line with text to convert a floating picture into inline.


The ReadOnlyDocumentImageCollection.Get method is designed to get images within the specified Range. To call the method, use the RichEditControl.Document.Images.Get notation.

Expanded Saving Pictures

When a document is saved as an RTF, inline pictures are saved two times: in the native format and as a metafile, both by default. Use the RtfDocumentExporterCompatibilityOptions.DuplicateObjectAsMetafile property to modify this behavior.

When a document is saved in HTML format, you can specify a location for storing images as external files, or process them before saving. To accomplish this, handle the RichEditControl.BeforeExport event and specify the HtmlDocumentExporterOptions.UriExportType and IExporterOptions.TargetUri. Moreover, you can implement your own class with the IUriProvider interface and specify it, instead of the default URI provider in the SubDocument.GetHtmlText method.

The Document.HtmlText method uses a special URI provider - the DataStringUriProvider, that converts an image to a base64-encoded representation with the "data:" prefix. Therefore, if you obtain the HTML of a document using the Document.HtmlText method, all images are embedded in a page.

Expanded See Also

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