The MVC Grid View allows you to export its data with ease. Using specific static methods provided at the GridViewExtension class level, the GridView's data can be exported to a file or stream in the following formats:
- PDF (WritePdf, ExportToPdf)
- XLS (WriteXls, ExportToXls)
- XLSX (WriteXlsx, ExportToXlsx)
- RTF (WriteRtf, ExportToRtf)
- DOCX (WriteDocx, ExportToDocx)
This demo illustrates how data within the Grid View can be exported to different formats - based on the Grid View's current settings (defined in a single location - within the Controller). These settings are passed to a View containing the grid's markup - 'View(partial)' and they are also used by export methods.
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
The source code files for this demo are installed (by default) in the following directory:
Open CS Solution
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxGridViewDemos