RichEditControl.HtmlText Property

Gets or sets the control's content as HTML text.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v20.1.dll

Declaration

[Bindable(true)]
[Browsable(false)]
public string HtmlText { get; set; }
<Bindable(True)>
<Browsable(False)>
Public Property HtmlText As String

Property Value

Type Description
String

A string containing text in HTML format.

Remarks

The HtmlText property returns the HTML document with base64-encoded images embedded in the document body.

The code sample below uses the HtmlText property to export a document to HTML format.

richEditControl.LoadDocument("FirstLook.docx", DocumentFormat.OpenXml);

// Export to HTML
File.WriteAllText("test.html", richEditControl.HtmlText);


// Show the result in a browser window.
System.Diagnostics.Process.Start("test.html");

Use the SubDocument.GetHtmlText method to get the HTML source that contains image references.

Specify a custom IUriProvider to retain the original image URI when a document is loaded and then saved. Refer to the How to: Retain the Image URI in HTML Document article for a code sample.

Use the Document.HtmlText when operating at the document level, or the SubDocument.GetHtmlText, to retrieve a document range in HTML format.

Handle the BeforeExport event to specify HtmlDocumentExporterOptions and export the HTML document correctly.

NOTE

If you set the HtmlText property to an HTML string, make sure that the string has the correct encoding.

Check the HTML Tag Support document for a list of supported HTML tags.

Check the HtmlText property value when the RichEditControl.DocumentLoaded event handler, i.e., when the document is fully loaded.

Implements

See Also