Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Increase column width in exported excel sheet using Ultrawebgrid. C#
posted

On saving excel file. the column width specified in code is not getting reflected in saved excel file. I have written this code where I have set width of column as 600.

Any help is highly appreciated.

protected void btnExportFile_Click(object sender, EventArgs e)

{

int aIndex = 0;

//turn off paging

UltraWebGrid1.DisplayLayout.Pager.AllowPaging = false;

DynamicReportSelection();

this.GridExcelExporter.DownloadName = txtFilePath.Text;

this.GridExcelExporter.ExportMode = ExportMode.Download;

//this.GridExcelExporter.Export(this.UltraWebGrid1)

Workbook wb= this.GridExcelExporter.Export(UltraWebGrid1)

foreach (Worksheet ws in wb.Worksheets)

{

ws.Columns[aIndex].Width = 600;

aIndex++;

}
}

Parents
No Data
Reply
  • 15
    posted

    After exporting the datagrid to Excel. It ask for save and on clicking on Save its not showing the column with width specified in the code. Please suggest.

Children
No Data