Skip to main content

MapControl.ExportToMht(String) Method

Exports the control’s data to an MHT file (Web archive, single file) at the specified path.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.1.dll

NuGet Package: DevExpress.Win.Map

Declaration

public void ExportToMht(
    string filePath
)

Parameters

Name Type Description
filePath String

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

Remarks

This method exports the current map as an *.MHT file to the specified path calling the PrintingSystemBase.ExportToMht method. 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. For more information, refer to the PrintingSystemBase.ExportToMht topic.

Note

The MapControl’s data can only be exported if the XtraPrinting Library is available.

Example

To export a map image to a file, use one of the following methods.

private void ddbExport_Click(object sender, EventArgs e) {
    string filepath = filepathBase + exportFormat.ToString();
    switch (exportFormat) {
        case (ExportFormat.Image):
            mapControl.ExportToImage(filepath, ImageFormat.Jpeg);
            break;
        case (ExportFormat.Mht):
            mapControl.ExportToMht(filepathBase);
            break;
        case (ExportFormat.Pdf):
            mapControl.ExportToPdf(filepathBase);
            break;
        case (ExportFormat.Xls):
            mapControl.ExportToXls(filepathBase);
            break;
        case (ExportFormat.Xlsx):
            mapControl.ExportToXlsx(filepathBase);
            break;
        default:
            MessageBox.Show("Export to a *" + exportFormat.ToString() + " file format is impossible.", "Export to " + exportFormat.ToString());
            return;
    }

    MessageBox.Show("Export to a *" + exportFormat.ToString() + " file is done.", "Export to " + exportFormat.ToString());
}
See Also