windowsforms-6879-controls-and-libraries-rich-text-editor-html-import-and-export-html-support-limitations.md
The Rich Text for WinForms is not designed to fully support the HTML format. Expect HTML interpretation to be limited and optimized for documents rather than web pages.
This topic describes these limitations, possible issues, and troubleshooting steps you may take when you process HTML documents.
RichEditControl converts HTML files into its internal document model. Some HTML tags and CSS attributes have no counterparts in Open XML and RTF formats. Some HTML tags and CSS attributes have no counterparts in Open XML and RTF formats. As such, we cannot guarantee that our components display HTML documents in the same manner as web browsers do.
The table below lists HTML tags that the RichEditControl supports. External links are processed for inline pictures and style sheets (CSS files). The id and class attributes are interpreted for all tags, including those not listed below.
| Tag | Attributes | Notes |
|---|---|---|
| a | dir | |
| b | dir | |
| background-color | The tag specifies the ParagraphPropertiesBase.BackColor property. Use the Paragraph Shading button in the User Interface to reset this parameter. | |
| base | ||
| basefont | size | |
| color | ||
| face | ||
| dir | ||
| big | dir | |
| blockquote | dir | |
| br | dir | |
| center | dir | |
| code | dir | |
| del | cite | |
| datetime | ||
| div | page-break-before | |
| page-break-after | ||
| page-break-inside | ||
| background-color | ||
| border (CSS) | ||
| dir | Only the always property value is supported for the page-break-before tag. | |
| em | dir | |
| font | size | |
| color | ||
| face | ||
| dir | ||
| h1-h6 | align | |
| dir | Specify a paragraph’s Paragraph.OutlineLevel property to mark text in an HTML output with H1 - H6 tags. Paragraphs with outline levels higher than 6 are exported as text enclosed in a P tag. | |
| head | ||
| html | ||
| hr | align | |
| color | ||
| noshade | ||
| size | ||
| width | ||
| i | dir | |
| ins | cite | |
| datetime | ||
| img | align | |
| src | ||
| height | ||
| width | If the align attribute is not specified, the image is considered as inline. | |
| li | type | |
| value | ||
| dir | ||
| link | href | |
| type | ||
| media | ||
| dir | ||
| meta | ||
| ol | type | |
| value | ||
| align | ||
| dir | ||
| p | align | |
| dir | ||
| line-height | ||
| small | ||
| span | ||
| strike | dir | |
| strong | dir | |
| style | ||
| sub | dir | |
| sup | dir | |
| table | align | |
| bgcolor | ||
| border | ||
| bordercolor | ||
| cellpadding | ||
| cellspacing | ||
| dir | ||
| width | The dir attribute reorders table columns and applies the table indent (specified by the Table.Indent property) to the right side of the table. | |
| td | align | |
| bgcolor | ||
| bordercolor | ||
| colspan | ||
| height | ||
| nowrap | ||
| rowspan | ||
| text-align | ||
| valign | ||
| width | The align tag is supported in Internet Explorer only. The bgcolor attribute specifies the TableCellPropertiesBase.NoWrap property value. | |
| The Rich Text Editor interprets the bordercolor attribute differently from an HTML browser. | ||
| th | any allowed | |
| tr | align | |
| bgcolor | ||
| bordercolor | ||
| height | ||
| text-align | ||
| valign | The align attribute is supported in Internet Explorer only. | |
| u | dir | |
| ul | dir |
font:The following document elements are not exported to HTML format:
Microsoft Word and other word processing applications allow you to save HTML documents with Microsoft Office mso-prefixed styles. For example, these styles are applied when you select Web Page type in the Save As dialog in Microsoft Word. The Rich Text Editor does not support these style types. To create a document compatible with DevExpress Rich Text Editor, save Microsoft Word documents in the Web Page, Filtered format.
RichEditControl processes media queries as regular CSS styles. The HtmlDocumentImporterOptions.IgnoreMediaQueries option allows you to ignore media rules in HTML documents.
richEditControl.Options.Import.Html.IgnoreMediaQueries = true;
richEditControl.Options.Import.Html.IgnoreMediaQueries = True
RichEditControl uses the Times New Roman font with size 12 as default font parameters in HTML documents.
The Normal style is exported as the default style. To change this behavior, set the HtmlDocumentExporterOptions.DefaultCharacterPropertiesExportToCss property to false and explicitly set the Document.DefaultCharacterProperties.ForeColor to Black.
richEditControl.Options.Export.Html.DefaultCharacterPropertiesExportToCss = false;
richEditControl.Document.DefaultCharacterProperties.ForeColor = System.Drawing.Color.Black;
richEditControl.Options.Export.Html.DefaultCharacterPropertiesExportToCss = False
richEditControl.Document.DefaultCharacterProperties.ForeColor = System.Drawing.Color.Black
You can also use this API to reduce the number of span tags in an HTML document.
Try one of the following solutions if issues occur with the HTML document output or an exception is thrown:
Make sure that the HTML document does not contain unsupported tags or elements (OLE objects, headers, and footers).
Enable exceptions when debugging the project. Refer to the following article for more information: Obtain an Exception’s Call Stack
Use global policy settings to spot, analyze, and prohibit unwanted download requests. Refer to the following article for more information: Suppress Control Requests to Download Data from External URLs
Compare the export result with Microsoft Word or other word processing application. If other word processors produce a different result (apart from the described limitations), please contact the DevExpress Support Team.
See Also
Import an HTML File into the Rich Text Editor or Export a Document to HTML