.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

IUriProviderService Interface

Represents a service that calls the registered IUriProvider interface when required.

Namespace: DevExpress.Office.Services

Assembly: DevExpress.Office.v19.2.Core.dll

Declaration

[ComVisible(true)]
public interface IUriProviderService
<ComVisible(True)>
Public Interface IUriProviderService
[ComVisible(true)]
public interface IUriProviderService
<ComVisible(True)>
Public Interface IUriProviderService
[ComVisible(true)]
public interface IUriProviderService
<ComVisible(True)>
Public Interface IUriProviderService

Remarks

Create a class that implements the IUriProvider interface to enable specify custom locations for exported images and styles. Call the IUriProviderService.RegisterProvider method to register the target service.

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1726.

Examples

This example demonstrates how to use the DocumentImage.Uri property to set the image's src attribute when a document is saved in HTML format. You can switch on the HtmlDocumentExporterOptions.EmbedImages option to observe that the custom URI provider is idle for embedded images.

Note

The complete sample project How to retain the original image URI in an HTML document is available in the DevExpress Examples repository.

using DevExpress.Office.Services;
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.XtraRichEdit.Export;
using System;
// ...
        private void richEditControl1_DocumentLoaded(object sender, EventArgs e)
        {
            IUriProviderService service = richEditControl1.GetService<IUriProviderService>();
            if (service != null) {
                service.RegisterProvider(new CustomUriProvider());
            }
        }
        private void richEditControl1_ContentChanged(object sender, EventArgs e)
        {
            ReloadHtml();
        }

        private void ReloadHtml()
        {
            HtmlDocumentExporterOptions exportOptions = new HtmlDocumentExporterOptions();
            exportOptions.EmbedImages = embedImagesCheck.Checked;
            string sText = richEditControl1.Document.GetHtmlText(richEditControl1.Document.Range, new CustomUriProvider(), exportOptions);
            memoEdit1.Text = sText;
        }
See Also