Completed
Last Updated: 12 Oct 2016 08:35 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 05 Aug 2016 07:38
Category: GridView
Type: Bug Report
0
FIX. RadGridView - broken columns layout after exporting when paging is enabled and the ShowGroupedColumns property is set to true
To reproduce:

public RadForm1()
{
    InitializeComponent();
    DataTable dt = new DataTable();
    for (int i = 0; i < 10; i++)
    {
        dt.Columns.Add("Col" + i);
    }

    for (int i = 0; i < 50; i++)
    {
        DataRow dr = dt.NewRow();
        foreach (DataColumn col in dt.Columns)
        {
            dr[col.ColumnName] = "Data." + i + "." + dt.Columns.IndexOf(col);
        }
        dt.Rows.Add(dr);
    }

    this.radGridView1.DataSource = dt;
    this.radGridView1.MasterTemplate.EnablePaging = true;
    this.radGridView1.MasterTemplate.ShowGroupedColumns = true;
}

public void ExportContactToExcelFile(string strFileName)
{
    GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1);
    SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
       
    spreadExporter.PagingExportOption = PagingExportOption.AllPages;
    spreadExporter.ExportVisualSettings = true;
    spreadExporter.SheetName = "Contacts";
    spreadExporter.RunExport(strFileName, exportRenderer);
}

private void radButton1_Click(object sender, EventArgs e)
{
    ExportContactToExcelFile(@"..\..\Export" + DateTime.Now.ToLongTimeString().Replace(":", "_") + ".xlsx");
}
 
Workaround: refresh the MasterTemplate after the export:

private void radButton1_Click(object sender, EventArgs e)
{
    ExportContactToExcelFile(@"..\..\Export" + DateTime.Now.ToLongTimeString().Replace(":", "_") + ".xlsx");
    this.radGridView1.MasterTemplate.Refresh();
}
Attached Files:
0 comments