MapControl.ExportToXlsx(String) Method
Exports the data displayed by the Map Control to the specified file in XLSX (MS Excel 2007) format.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
filePath | String | A string that specifies the full path to the file to which the data is exported. |
Remarks
This method exports the current map as a *.XLSX file to the specified path, calling the PrintingSystemBase.ExportToXlsx method. After creating a XLSX file, the map can be displayed in an appropriate application. For more information refer to the PrintingSystemBase.ExportToXlsx 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.
- MapControl.ExportToImage - exports the map to an image file;
- MapControl.ExportToMht - exports the map to a *.MHT file;
- MapControl.ExportToPdf - exports the map to a *.PDF file;
- MapControl.ExportToXls - exports the map to a *.XLS file;
- MapControl.ExportToXlsx - exports the map to a *.XLSX file;
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