SubDocument.AppendHtmlText(String) Method
Appends HTML formatted text.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v20.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.WindowsDesktop.RichEdit.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
htmlText | String | A string containing data in HTML format. |
Returns
Type | Description |
---|---|
DocumentRange | A DocumentRange representing a range with appended content. |
Remarks
The AppendHtmlText method imports the specified string in HTML format into the internal document model.
Note
Do not include the meta charset attribute in the HTML string that is supplied to this method. It will result in incorrect character encoding.
If the HTML string contains links to external content, such as pictures, the corresponding attributes should contain a valid URL from which the content can be downloaded.
After the string is successfully imported, the new document model is inserted at the end of the main document.
If the Paragraph.ContextualSpacing property of the last paragraph is false (default), RichEditControl inserts additional space between inserted HTML paragraphs. To remove the extra space, set the Paragraph.ContextualSpacing option to true for paragraphs in the document and set the Paragraph.SpacingAfter property of the current paragraph and the Paragraph.SpacingBefore property of the next paragraph to zero (0).
Note
If you want more control over the text before it is inserted, create an instance of the RichEditDocumentServer and load the string into it. Then, use the SubDocument.AppendDocumentContent method to append the modified document.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the AppendHtmlText(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.