简体   繁体   中英

Export to Excel for telerik radgrid

I want to export current date along with radgrid data to the excel sheet. How can I do this?

For exporting radgrid I am using following code:

public void ExportExcel(RadGrid radGrid)
    {
        if (radGrid == null)
            throw new ArgumentNullException("radGrid");
        Page.IsExporting = true;

        //Export settings
        radGrid.ExportSettings.HideStructureColumns = true;
        radGrid.ExportSettings.SuppressColumnDataFormatStrings = false;
        radGrid.ExportSettings.ExportOnlyData = true;
        radGrid.ExportSettings.IgnorePaging = true;


        //Excel Format
        radGrid.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;

        SetExportFileName(radGrid);

        radGrid.MasterTableView.ExportToExcel();
    }

First row of excel sheet should be- Date: Jan 30, 2014

then data of the radgrid should be displayed.

写就好了

radGrid.MasterTableView.Caption = "Title";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM