Skip to main content

PivotGridControl.ExportToMht(String, String, String, Boolean) Method

Exports the Pivot Grid Control’s data to an MHT file (Web archive, single file) with the specified path and title. The output file can be compressed (secondary characters e.g. spaces are removed) if required.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.1.dll

NuGet Package: DevExpress.Win.PivotGrid


public void ExportToMht(
    string filePath,
    string htmlCharSet,
    string title,
    bool compressed


Name Type Description
filePath String

A String which specifies the full path (including the file name and extension) to where the MHT file will be created.

htmlCharSet String

A String which specifies the encoding name set in the MHT file (e.g. “UTF-8”).

title String

A String which specifies the name shown as the title of the created MHT document.

compressed Boolean

true to compress the MHT code (secondary characters e.g. spaces are removed); otherwise, false.


This method overwrites any files present at the specified path that have the same name without warning. Note that the .mht (or an appropriate) extension has to be specified in the path. After an MHT document has been created, it can be displayed in a Web browser. MHT code in the compressed form doesn’t contain any secondary symbols like Space or Carriage Return symbols.

The Pivot Grid Control’s data can only be exported if the XtraPrinting Library is available. Use the PivotGridControl.IsPrintingAvailable property to check whether the grid’s data can be exported.

See Also