MapControl.ExportToXlsx(String) Method
Exports the map data to the specified XLSX file.
Namespace: DevExpress.Xpf.Map
Assembly: DevExpress.Xpf.Map.v24.2.dll
NuGet Package: DevExpress.Wpf.Map
Declaration
Parameters
Name | Type | Description |
---|---|---|
filePath | String | A string value, specifying the file path. |
Example
To export a map image to a file, use one of the following methods.
- MapControl.ExportToHtml - exports the map to a *.HTML file;
- 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.ExportToRtf - exports the map to a *.RTF file;
- MapControl.ExportToXls - exports the map to a *.XLS file;
- MapControl.ExportToXlsx - exports the map to a *.XLSX file;
- MapControl.ExportToXps - exports the map to a *.XPS file;
using System;
using System.Windows;
using DevExpress.XtraPrinting;
namespace Exporting {
public partial class MainWindow : Window {
const string filename = "exportedMap";
public MainWindow() {
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e) {
ExportFormat format = (ExportFormat)cbExportFormat.SelectedItem;
string filepath;
if (format == ExportFormat.Image)
filepath = String.Format("{0}.jpg", filename);
else
filepath = String.Format("{0}.{1}", filename, format);
bool isExported = true;
switch (format) {
case (ExportFormat.Htm):
mapControl.ExportToHtml(filepath);
break;
case (ExportFormat.Image):
mapControl.ExportToImage(filepath);
break;
case (ExportFormat.Mht):
mapControl.ExportToMht(filepath);
break;
case (ExportFormat.Pdf):
mapControl.ExportToPdf(filepath);
break;
case (ExportFormat.Rtf):
mapControl.ExportToRtf(filepath);
break;
case (ExportFormat.Xls):
mapControl.ExportToXls(filepath);
break;
case (ExportFormat.Xlsx):
mapControl.ExportToXlsx(filepath);
break;
case (ExportFormat.Xps):
mapControl.ExportToXps(filepath);
break;
default:
isExported = false;
break;
}
if (isExported)
MessageBox.Show(String.Format("Map exported successfully."));
else
MessageBox.Show(String.Format("Map exporting does not support the {0} file format.", format));
}
}
}
See Also