DevExpress : How to set the column width when exporting GridView to Excel
In this article we are discuss in DevExpress How to set the column width when exporting GridView to Excel
Change to Export Width to Using GridViewColumn.ExportWidth property
public static GridViewSettingsReportBookingSummaryExportGridViewSettings()
{
var settings = new GridViewSettings
{
CallbackRouteValues = new { Controller = "ReportGenerator", Action = "gvSummaryDtl" },
Name = "gvSummary"
};
settings.SettingsExport.ExportedRowType = GridViewExportedRowType.All;
settings.KeyFieldName = "{ numID }";
settings.Settings.ShowGroupPanel = true;
settings.Settings.ShowFilterRowMenu = true;
settings.Settings.ShowFooter = true;
settings.Settings.ShowGroupFooter = GridViewGroupFooterMode.VisibleAlways;
settings.Columns.Add(col => {
col.FieldName = "Name";
col.ExportWidth = 500;
});
}