HtmlExporter(DocumentModel, HtmlDocumentExporterOptions) Constructor
Initializes a new instance of the HtmlExporter class with the specified Document Model and HTML export options.
Namespace: DevExpress.XtraRichEdit.Export.Html
Assembly: DevExpress.RichEdit.v19.1.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
documentModel | DevExpress.XtraRichEdit.Model.DocumentModel | A current Document Model. |
options | HtmlDocumentExporterOptions | A HtmlDocumentExporterOptions instance containing HTML export options. |
Remarks
The HtmlExporter is used to export the document to HTML format. After creating the class instance for the specified document model, and with the specified export options, call the HtmlExporterBase.Export method to accomplish the task.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/export-to-html-how-to-export-only-body-tag-content-and-specify-the-location-of-css-styles-e1726
using DevExpress.XtraRichEdit.Export;
using DevExpress.XtraRichEdit.Export.Html;
using DevExpress.XtraRichEdit.Commands;
using DevExpress.Office.Services;
private void ExportHtml(out string stringHtml, HtmlExporter exporter, string fileName) {
stringHtml = String.Empty;
HtmlDocumentExporterOptions options = new HtmlDocumentExporterOptions();
options.ExportRootTag = htmlExportType;
options.CssPropertiesExportType = cssExportType;
options.TargetUri = Path.GetFileNameWithoutExtension(fileName);
exporter = new HtmlExporter(this.richEditControl1.Model, options);
stringHtml = exporter.Export();
}
For more information on the document model and the document structure in general, see the Document Elements section.