Skip to main content
A newer version of this page is available. .

Inline Pictures

  • 2 minutes to read

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 article.

Overview

InlinePicture

Inline picture is the DocumentImage object instance. It substitutes one character and occupies two positions having a range length equal to 1.

The DocumentImage.Image property provides access to the lower 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 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 lllustrations Ribbon page group.

DXRichEdit_Ribbon_Illustrations

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.

Saving Pictures

When a document is saved in an 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 via the Document.HtmlText method, all images are embedded in a page.