Exporting to PDF, XLS, XLSX, CSV and RTF

The Grid View Exporter control allows you to export Grid View data with ease. Data can be exported to a file or stream in the following formats:

  • PDF (WritePdf, WritePdfToResponse)
  • XLS (WriteXls, WriteXlsToResponse)
  • XLSX (WriteXlsx, WriteXlsxToResponse)
  • RTF (WriteRtf, WriteRtfToResponse)
  • CSV (WriteCsv, WriteCsvToResponse)

Note that in this demo, export to table formats (XLS, XLSX, and CSV) is performed in the WYSIWYG (What You See Is What You Get) mode. Therefore, the table formatting, e.g., grouping, is lost and grid summaries are converted to strings. However, you can maintain such information by exporting grid data in the data-aware mode.

Export To:

Drag a column header here to group by that column
Product NameCategorySupplierQuantity Per UnitUnit Price
ChaiBeveragesExotic Liquids10 boxes x 20 bags$18.00
ChangBeveragesExotic Liquids24 - 12 oz bottles$19.00
Aniseed SyrupCondimentsExotic Liquids12 - 550 ml bottles$10.00
Chef Anton's Cajun SeasoningCondimentsNew Orleans Cajun Delights48 - 6 oz jars$22.00
Chef Anton's Gumbo MixCondimentsNew Orleans Cajun Delights36 boxes$21.00
Grandma's Boysenberry SpreadCondimentsGrandma Kelly's Homestead12 - 8 oz jars$25.00
Uncle Bob's Organic Dried PearsProduceGrandma Kelly's Homestead12 - 1 lb pkgs.$30.00
Northwoods Cranberry SauceCondimentsGrandma Kelly's Homestead12 - 12 oz jars$40.00
Mishi Kobe NikuMeat/PoultryTokyo Traders18 - 500 g pkgs.$97.00
IkuraSeafoodTokyo Traders12 - 200 ml jars$31.00
<dx:ASPxGridViewExporter ID="GridViewExporter1" runat="server" GridViewID="GridView1"></dx:ASPxGridViewExporter>
<dx:BootstrapGridView ID="GridView1" runat="server" DataSourceID="DataSource1">
    <Settings ShowGroupPanel="True" />
    <Columns>
        <dx:BootstrapGridViewDataColumn FieldName="ProductName" />
        <dx:BootstrapGridViewDataColumn FieldName="Category" />
        <dx:BootstrapGridViewDataColumn FieldName="Supplier" />
        <dx:BootstrapGridViewDataColumn FieldName="QuantityPerUnit" />
        <dx:BootstrapGridViewTextColumn FieldName="UnitPrice">
            <PropertiesTextEdit DisplayFormatString="c" />
        </dx:BootstrapGridViewTextColumn>
    </Columns>
</dx:BootstrapGridView>

Data Aware Export

The Grid View Exporter can export data to XLS and XLSX formats in the data-aware mode. In this mode, the DevExpress Export Engine maintains data grouping layout and automatically transforms summary items to corresponding Excel functions.

Export To:

Order IDOrder DateCompany NameShipped DateShip CitySale Amount
Ship Country: Austria (Continued on the next page)
 1035111/11/2014Ernst Handel11/20/2014 12:00:00 AMGraz$5,445.00
 1035311/13/2014Piccolo und mehr11/25/2014 12:00:00 AMSalzburg$8,603.00
 1038212/13/2014Ernst Handel12/16/2014 12:00:00 AMGraz$2,900.00
 104021/2/2015Ernst Handel1/10/2015 12:00:00 AMGraz$2,695.00
 104301/30/2015Ernst Handel2/3/2015 12:00:00 AMGraz$4,880.00
 105144/22/2015Ernst Handel5/16/2015 12:00:00 AMGraz$8,648.00
 105305/8/2015Piccolo und mehr5/12/2015 12:00:00 AMSalzburg$4,190.00
 105957/10/2015Ernst Handel7/14/2015 12:00:00 AMGraz$4,770.00
 106338/15/2015Ernst Handel8/18/2015 12:00:00 AMGraz$5,483.00
 1069810/9/2015Ernst Handel10/17/2015 12:00:00 AMGraz$3,436.00
 1077612/15/2015Ernst Handel12/18/2015 12:00:00 AMGraz$6,656.00
<dx:ASPxGridViewExporter ID="GridViewExporter2" runat="server" GridViewID="GridView2"></dx:ASPxGridViewExporter>
<dx:BootstrapGridView ID="GridView2" runat="server" DataSourceID="DataSource2">
    <Columns>
        <dx:BootstrapGridViewTextColumn FieldName="OrderID" />
        <dx:BootstrapGridViewDateColumn FieldName="OrderDate" />
        <dx:BootstrapGridViewTextColumn FieldName="ShipCountry" GroupIndex="0" />
        ...
    </Columns>
    <Settings ShowGroupPanel="True" ShowFooter="True" ShowGroupFooter="VisibleIfExpanded" />
    <GroupSummary>
        <dx:ASPxSummaryItem FieldName="OrderID" SummaryType="Count" ShowInGroupFooterColumn="OrderDate" />
        <dx:ASPxSummaryItem FieldName="SaleAmount" SummaryType="Sum" ShowInGroupFooterColumn="SaleAmount" />
    </GroupSummary>
    <TotalSummary>
        <dx:ASPxSummaryItem FieldName="OrderID" SummaryType="Count" ShowInColumn="OrderDate" />
        <dx:ASPxSummaryItem FieldName="SaleAmount" SummaryType="Sum" />
    </TotalSummary>
</dx:BootstrapGridView>

Export Selected Records

To export only the currently selected grid rows, set the Grid View Exporter’s ExportSelectedRowsOnly property to true.

Export To:

Product NameCategorySupplierQuantity Per UnitUnit Price
ChaiBeveragesExotic Liquids10 boxes x 20 bags$18.00
ChangBeveragesExotic Liquids24 - 12 oz bottles$19.00
Aniseed SyrupCondimentsExotic Liquids12 - 550 ml bottles$10.00
Chef Anton's Cajun SeasoningCondimentsNew Orleans Cajun Delights48 - 6 oz jars$22.00
Chef Anton's Gumbo MixCondimentsNew Orleans Cajun Delights36 boxes$21.00
Grandma's Boysenberry SpreadCondimentsGrandma Kelly's Homestead12 - 8 oz jars$25.00
Uncle Bob's Organic Dried PearsProduceGrandma Kelly's Homestead12 - 1 lb pkgs.$30.00
Northwoods Cranberry SauceCondimentsGrandma Kelly's Homestead12 - 12 oz jars$40.00
Mishi Kobe NikuMeat/PoultryTokyo Traders18 - 500 g pkgs.$97.00
IkuraSeafoodTokyo Traders12 - 200 ml jars$31.00
<dx:ASPxGridViewExporter ID="GridViewExporter3" runat="server" GridViewID="GridView3" ExportSelectedRowsOnly="true"></dx:ASPxGridViewExporter>
<dx:BootstrapGridView ID="GridView3" runat="server" DataSourceID="DataSource3" AutoGenerateColumns="False" KeyFieldName="ProductID">
    <Columns>
        <dx:BootstrapGridViewCommandColumn SelectAllCheckboxMode="AllPages" ShowSelectCheckbox="true"></dx:BootstrapGridViewCommandColumn>
        ...
    </Columns>
</dx:BootstrapGridView>
Screen Size
Color Themes
Demo QR Code