Exporting
- 4 minutes to read
XAF allows you to export List View data and analysis data to various formats (XLS, PDF, CSV, etc.). The following View Controllers ship with the export functionality:
- ExportController – Exports List View data.
- ExportAnalysisController - Exports analysis data.
Export List View Data (Blazor, Windows Forms, and Web Forms Apps)
The Export Controller is designed to export List View data. If the default implementation of the Export Controller does not meet your needs, handle its events or the events of its platform-specific descendant:
- ASP.NET Core Blazor – BlazorExportController
- Windows Forms – WinExportController
- ASP.NET Web Forms – WebExportController
The controllers mentioned above contain the Export to Action. To see examples of how to customize this Action, refer to the following topic: How to: Customize the Export Action Behavior.
The Export to Action is activated for the current List View if the List Editor supports the IExportable interface and the List Editor’s control supports the IPrintable
interface. Editors that meet these criteria depend on your application platform.
Platform | List Editors that Support IExportable |
---|---|
ASP.NET Core Blazor | |
Windows Forms | |
ASP.NET Web Forms |
When you use any of the XAF List Editors mentioned above, your application already includes the export functionality without the need to add a line of code. If you use a custom List Editor to present a List View, its data can be exported as well. To do this, make sure that this List Editor supports the IExportable interface and the editor’s control implements the IPrintable interface.
ASP.NET Core Blazor
The Export to Action exports List View data to a memory stream. This Action is only displayed in List Views whose EditorType is DxGridListEditor.
The supported exported formats are:
- CSV
- XLS
- XLSX
To export List View data, follow the steps below:
Click Export to -> {Format_Name} File on the List View main toolbar.
The application saves the exported file to your device. The file name is the name of the exported List View.
To perform this operation, XAF uses the data-aware export that ships with the DevExpress Blazor Grid. For more information on this functionality and its limitations, refer to the following topic: Blazor Grid - Export Data.
Windows Forms
The Export to Action exports data to a file stream. The supported file formats are:
- XLS
- HTML
- Text
- MHT
- RTF
- Image
To export List View data, follow the steps below:
Select File -> Export to -> {Format_Name} File from the main menu.
Specify a file name/location and click Save.
To localize the Save as type filter captions, use the Localization | OpenSaveDialogFilters node in the Model Editor.
ASP.NET Web Forms
The Export to Action exports data to a memory stream. Then, the application passes this stream to a client browser that saves it to a file. The supported file formats are:
- XLS
- HTML
- Text
- MHT
- RTF
- Image
To export List View data, follow the steps below:
Select File -> Export to -> {Format_Name} File from the main menu.
Use the displayed dialog to open or save the exported file.
Export Analysis Data (Windows Forms and Web Forms Apps)
When you add the Pivot Chart module to your application, XAF uses one of the following Property Editors in the Analysis Detail View:
- Windows Forms –
AnalysisEditorWin
- ASP.NET Web Forms –
AnalysisEditorWeb
These Property Editors use a Pivot Grid and Chart to display data. The Export Analysis Controller is designed to export data in the same way as it is shown in these Property Editors. So, it is unlikely that you may need to customize this Controller. However, in case you have specific requirements, this Controller exposes useful events. For more information, refer to the Export Analysis Controller’s description.
The Controller contains the Export Analysis to Action and ships with the following platform-specific descendants:
- Windows Forms –
WinExportAnalysisController
- ASP.NET Web Forms –
WebExportAnalysisController
Windows Forms
The Export Analysis to Action exports analysis data to a file stream. The supported file formats are:
- MHT
- XLS
- HTML
- Image
- RTF
- Text
To export analysis data, follow the steps below:
Select File -> Export Analysis to -> {Format_Name} File from the main menu.
Use the displayed dialog to specify an exported file’s name and location.
The image below displays sample files with exported data:
ASP.NET Web Forms
The Export Analysis Action exports analysis data to a memory stream. The supported file formats are:
- XLS
- HTML
- Text
- MHT
- RTF
- Image
To export analysis data, follow the steps below:
Select File -> Export Analysis to -> {Format_Name} File from the main menu.
The invoked dialog allows you to open or save the exported file.