Skip to main content
A newer version of this page is available. .

Built-in Export

  • 3 minutes to read

Note

Supported Versions: The information in this topic applies to DevExpress ASP.NET Card View v17.2 and later.

You can use the built-in standard toolbar commands and client-side/server-side API to export ASPxCardView data.

Note

Export with the built-in toolbar commands and client-side API is disabled by default due to possible security issues. To enable this functionality, set the ASPxGridExportSettings.EnableClientSideExportAPI property to true.

  • Standard Toolbar Commands

    The ASPxCardView toolbar provides frequently used grid commands that include export commands. Use the CardViewToolbarItem.Command property setting to specify a standard grid export command (listed below). See the following help topic for more information on how to use grid toolbars: ASPxCardView toolbars. You can also refer to the following DevExpress ASP.NET Card View demo: Toolbar.

    <dx:ASPxCardView ID="CardView" runat="server" KeyFieldName="ProductID" DataSourceID="ProductsDataSource" Width="100%">
        <Toolbars>
        <dx:CardViewToolbar EnableAdaptivity="true">
                <Items>
                    <dx:CardViewToolbarItem Command="ExportToXls" />
                    <dx:CardViewToolbarItem Command="ExportToXlsx" />
                    <dx:CardViewToolbarItem Command="ExportToRtf" />
                </Items>
            </dx:CardViewToolbar>
        </Toolbars>
        <Columns>
        ...
        </Columns>
    </dx:ASPxCardView>
    

    ASPxCardView-Export-ToolbarItems

  • Export API

    Execute the corresponding client or server method (based on the export format) to implement grid data export.

    The following examples illustrate how to use client and server exporting methods:

    • Client API

      <dx:ASPxCardView ID="ASPxCardView1" ClientInstanceName="cardView" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" KeyFieldName="ProductID">
      <SettingsExport EnableClientSideExportAPI="true"></SettingsExport>
          <Columns>
          ...
          </Columns>
      </dx:ASPxCardView>
      <br />
      <dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Export">
          <ClientSideEvents Click="function(s, e) {
              cardView.ExportTo(ASPxClientCardViewExportFormat.Xls);
          }" />
      </dx:ASPxButton>
      
    • Server API

      switch(e.Item.Name) {
          case "CustomExportToXLS":
              CardView.ExportXlsToResponse(new DevExpress.XtraPrinting.XlsExportOptionsEx { ExportType = ExportType.WYSIWYG });
              break;
          case "CustomExportToXLSX":
              CardView.ExportXlsxToResponse(new DevExpress.XtraPrinting.XlsxExportOptionsEx { ExportType = ExportType.WYSIWYG });
              break;
          default:
              break;
      }
      

You can use the ASPxCardView.StylesExport property to customize the exported ASPxCardView element appearance.

Note

ASPxCardView cannot export template content or data columns that are hidden.

Note that templated elements are exported with their default display settings. For instance, if you export a card view with templated cells, they are displayed with default text labels in the exported file.

Excel Data Aware Export

When you export data in XLS and XLSX formats, the following is included in the exported Excel document:

  • Data sorting and filtering - allow end users to display relevant data in the desired order.
  • Totals summaries - enable users to modify formulas.
  • Format conditions - allow users to change conditional formatting rules.
  • Data validation for combo-box columns
  • Fixed columns

Export Limitations

Note that when you export data to Excel formats, the following limitations apply:

Data Aware Mode Limitations

You can use the WYSIWYG (What You See Is What You Get) export mode to avoid these limitations. Note, however, that table formatting is lost in this mode.

ASPxCardView1.ExportXlsxToResponse(new XlsxExportOptionsEx { ExportType = ExportType.WYSIWYG });

Online Demos

To see the data export feature in action, refer to the following DevExpress ASP.NET Card View demos:

Exporting to Different Formats

Export Selected Cards

Export with Format Conditions

Task-Based Help

See Also