C# – Export To Excel a gridcontrol from devexpress with autosize of columns


I'm using a grid control from devexpress.I export the informations to excel using this code :


But when I export data to excel or pdf all the columns has width of 1 cm.How can I export to excel/pdf and make autosize to columns or keep the width columns from the grid?(in grid the columns has autosize and looks fine).


Best Solution

Please try to call grdExport.BestFitColumns Method
and set grdExport.OptionsPrint.AutoWidth property to false.

Check this Question