RichEditControl.HtmlText Property

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

Namespace: DevExpress.Xpf.RichEdit

Assembly: DevExpress.Xpf.RichEdit.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 and embedded images.

Use the SubDocument.GetHtmlText method to get HTML source that contains image references.
Specify a custom IUriProvider to retain the original image URI when a document is loaded and then saved using the OfficeImage.Uri property. Refer to the How to: Retain the Image URI in an HTML Document topic for a code example.

Use the Document.HtmlText to operate at the document level. The SubDocument.GetHtmlText method retrieves a document range in HTML format.

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

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

The code sample below retrieves and saves the document content in HTML format:

string htmlText = richEditControl1.HtmlText;
  using (FileStream stream = new FileStream("result.html",
   FileMode.Create, FileAccess.Write))
  {
      using (StreamWriter writer = new StreamWriter(stream))
      {
          writer.Write(htmlText);
      }
  }

System.Diagnostics.Process.Start("result.html");

Implements

See Also