Back to Devexpress

Export to MHT

xtrareports-2576-feature-guide-to-devexpress-reports-store-and-distribute-reports-export-reports-export-to-mht.md

latest5.1 KB
Original Source

Export to MHT

  • Feb 18, 2026
  • 7 minutes to read

This document describes how to export a report document to MHT format.

You can export a report from the Report Designer’s Preview and the Document Viewer on all supported platforms (WinForms, WPF, ASP.NET Web Forms, ASP.NET MVC, and ASP.NET Core). To do this, expand the Export Document drop-down list and select MHT File. Specify export options in the invoked dialog, and click OK.

To export a report document to MHT format in code, use one of the following approaches:

  • Export a Report

  • Export a Document

  • Export a Control

Export Options

The options that can be specified for a document exported to an MHT file are stored in the MhtExportOptions class. Use the report’s ExportOptions.Mht property to access these options.

The HtmlExportOptionsBase.ExportMode property determines how a document is exported to MHT. For instance, it may be exported to a single file (with a single page header at the start and a single page footer at the end) or it may be exported page-by-page to a single file or different files.

The HtmlExportOptionsBase.TableLayout property determines whether to use the table layout in the exported MHT file. The table layout is recommended, as it uses a more compact and efficient markup.

Overlapped Controls

To ensure that report controls are exported, they should not intersect. Otherwise, the file layout can be corrupted.

Overlapped controls are highlighted in reports. Users can move the mouse pointer over these controls to see what needs to be fixed.

Use a report’s HasExportWarningControls collection to check if there are controls that have export warnings.
Disable a report’s DesignerOptions.ShowExportWarnings property to remove highlights on overlapped controls.

To export a report that contains overlapped controls, use the non-table layout.

Document Compatibility Options

The document styles are added to the MHT document’s <head> section. Certain mail programs may ignore styles listed in this section. To maintain a consistent look for your reports, enable the HtmlExportOptionsBase.InlineCss property to specify style properties at the same place where styles are assigned.

This property also affects how the XRPictureBox and XRBarCode controls are rendered on a web page. Images in these controls are assigned to the background-image style property. Enable the HtmlExportOptionsBase.InlineCss property to render these controls as \ elements in the document body and store the images in the src attribute in the base64 format.

Vector images (for instance, pictures, charts, or bar codes) are always rasterized on export to MHT. You can use the PageByPageExportOptionsBase.RasterizationResolution property to specify the image resolution.

Document navigation uses scripts. To use HTML link-based navigation instead, enable the HtmlExportOptionsBase.UseHRefHyperlinks property. When users view such a document in a client web browser, script security messages are not displayed. Ensure that the controls’ Text properties are specfiied - otherwise links contain empty text and users cannot click them.

Limitations

If a report uses a CachedReportSource, changes made in Preview are not included in single-file exports.