aspnetmvc-115983-components-card-view-export-built-in-export.md
The ASP.NET MVC CardView extension allows users to export its data to a file or stream in CSV, DOCX, PDF, RTF, XLS, and XLSX format.
MVCxCardView data exporting can be implemented using standard toolbar commands and the server and client API.
Note
Follow the instructions below to ensure the exporting functionality works correctly:
Refer to the Built-in Exporting article to get more information on exporting GridView rows while retaining end-user modifications (such as sorting, grouping, filtering, selection).
The MVCxCardView toolbar provides frequently used grid commands, including exporting commands. Specify a standard grid exporting command (listed below) using the CardViewToolbarItem.Command property setting. Refer to the Toolbar online demo for more information on using grid toolbars.
settings.SettingsExport.EnableClientSideExportAPI = true;
settings.Toolbars.Add(t => {
t.EnableAdaptivity = true;
t.Items.Add(CardViewToolbarCommand.ExportToPdf);
t.Items.Add(CardViewToolbarCommand.ExportToDocx);
});
Call the client ExportTo(format) method to implement grid data exporting.
@Html.DevExpress().CardView(settings => {
settings.Name = "CardView";
settings.SettingsExport.EnableClientSideExportAPI = true;
...
}).Bind(Model).GetHtml()
...
<div class="button">
@Html.DevExpress().Button(s => {
s.Name = "ExpBtn";
s.Text = "Export";
s.AutoPostBack = "false";
s.ClientSideEvents.Click = "function(s,e){ CardView.ExportTo(ASPxClientCardViewExportFormat.Pdf);}";
}).GetHtml()
Refer to the following online demos to see the data export in action: