RadControls – RadGrid export to Excel with text format


void btnExport_Click(object sender, ImageClickEventArgs e)
{
rgGrid.ExcelExportCellFormatting += new OnExcelExportCellFormattingEventHandler(rgKBuser_ExcelExportCellFormatting);
rgGrid.MasterTableView.ExportToExcel();

}
void rgKBuser_ExcelExportCellFormatting(object sender, ExcelExportCellFormattingEventArgs e)
{
e.Cell.Style["mso-number-format"] = @"\@";
}

Reference: http://www.telerik.com/help/aspnet-ajax/grid-html-export.html

沒有留言:

張貼留言