Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Expand]Document Structure
    [Collapse]Document Elements
      Positions and Ranges
      Characters
      Paragraphs
      Inline Pictures
      Hyperlinks and Bookmarks
      Headers and Footers
      Tables
      Range Permissions
      Sections
      Styles
      Numbered and Bulleted Lists
      Floating Objects (Shapes)
      Text Boxes
      Comments
      Document Properties
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Spell Checking
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
    Services
    Events
    Commands
   [Expand]Member Tables
    Keyboard Shortcuts
    HTML Tag Interpretation
   [Expand]Examples
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Inline Pictures

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

Important

This document describes inline pictures. For information about floating pictures, refer to the Floating Objects (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.

Tip

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

How would you rate this topic?​​​​​​​