I am exporting a grid to Excel but the columns width make it unreadable. Any way to autosize the column width withthe export?
Thanks
Scott
Hello Scott,
I am not sure but I think that there is not way to set the AutoFit style on the columns in the excel file yet. What you could do is the change the Height of the Cells in order to show the all text in the cell. One way to do that is to iterate through the columns of the Worksheet and set the WrapText property to true in the BeginExport event of the UltraGridExcelExporter like :
private void ultraGridExcelExporter1_BeginExport(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.BeginExportEventArgs e) { for (int i = 0; i < ultraGrid1.DisplayLayout.Bands[0].Columns.Count ; i++) { e.CurrentWorksheet.Columns[i].CellFormat.WrapText = Infragistics.Excel.ExcelDefaultableBoolean.True; } }
Please let me know if you have any other questions on this matter.