Issue in RadGrid Export to Excel functionality

14 posts, 1 answers
  1. Ruchi
    Ruchi avatar
    54 posts
    Member since:
    Apr 2012

    Posted 21 Nov 2015 Link to this post

    Hi Team,

          We are binding radgrid from server side,  and using default Export to Excel functionality. The problem area is when we export the excel we are getting Extra Words like "Sorted ascSorted desc" in Column Header along with Column Name. We have tried few related properties of export settings but failed to resolve the issue. For your reference attaching problematic excel screenshot and also grid settings below.

    Please do needful as soon as possible.

    Thanks.

                RadAjaxLoadingPanel RadajaxloadingpanelTestdata = new RadAjaxLoadingPanel();
                RadajaxloadingpanelTestdata.ID = "Radajaxloadingpanel_AccActWidget_" + WidMapID;
                this.Controls.Add(RadajaxloadingpanelTestdata);

                RadAjaxPanel panel_testdata = new RadAjaxPanel();
                panel_testdata.ID = WidMapID;

                RadGrid rgTestData = new RadGrid();
                rgTestData.ID = WidMapID;
                rgTestData.AllowPaging = true;
                rgTestData.AllowSorting = true;
                rgTestData.AutoGenerateColumns = false;
                rgTestData.ExportSettings.IgnorePaging = true;
                rgTestData.ExportSettings.ExportOnlyData = true;
                rgTestData.ExportSettings.Excel.Format.Equals("Biff");
                rgTestData.ExportSettings.HideStructureColumns = true;
                rgTestData.ExportSettings.FileName = "CountsOfTestsLoaded";
                rgTestData.ExportSettings.Pdf.ForceTextWrap = true;
                rgTestData.MasterTableView.DataKeyNames = new string[] { "VerifyDate" };
                rgTestData.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Bottom;
                rgTestData.MasterTableView.ClientDataKeyNames = new string[] { "VerifyDate" };
                rgTestData.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
                rgTestData.MasterTableView.CommandItemStyle.Height.Equals("22px");
                rgTestData.MasterTableView.CommandItemStyle.HorizontalAlign = HorizontalAlign.Right;
                rgTestData.MasterTableView.PagerStyle.AlwaysVisible = true;
                rgTestData.MasterTableView.PagerStyle.Mode.Equals("NextPrevAndNumeric");
                rgTestData.ShowHeader = true;
                rgTestData.ClientSettings.Selecting.AllowRowSelect = true;
                rgTestData.MasterTableView.CommandItemTemplate = new MyCommandItemTemplate() { IsRefresh = true, IsExcel = true, IsPdf = true, IsCsv = true };
                BoundColumns(rgTestData);
                panel_testdata.ClientEvents.OnRequestStart = "onRequestStartTestData";
                panel_testdata.LoadingPanelID = RadajaxloadingpanelTestdata.ClientID;
                this.Controls.Add(panel_testdata);
                panel_testdata.Controls.Add(rgTestData);

  2. Answer
    Nils C.
    Nils C. avatar
    41 posts
    Member since:
    Oct 2009

    Posted 06 Jan Link to this post

    Hi there.

    Did you find a solution for this yet?

    We are facing the same issue..

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ruchi
    Ruchi avatar
    54 posts
    Member since:
    Apr 2012

    Posted 08 Jan in reply to Nils C. Link to this post

    Hi Nils,

    We haven't got any solution for this. Please let us know if you fiund.

     

    Thanks,

    Ruchi Patel

  5. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 11 Jan Link to this post

    Hi Ruchi,

    We are aware of this issue and I am afraid this is a bug in the binary export formats (Biff, Xlsx and Docx). Nevertheless, our developers already fixed the issue and it will be included in our next official release which will be available till the end of the week. Meanwhile as a workaround you can manually disable the sorting when export the grid.
    protected void btnExport_Click(object sender, EventArgs e)
    {
        MyRadGrid.AllowSorting = false;
        if (!MyRadGrid.ExportSettings.IgnorePaging)
        {
            MyRadGrid.Rebind();
        }
        MyRadGrid.MasterTableView.ExportToExcel();
    }


    Regards,
    Kostadin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Ruchi
    Ruchi avatar
    54 posts
    Member since:
    Apr 2012

    Posted 14 Jan in reply to Kostadin Link to this post

    Hi Kostadin,

    Thank you for suggestion the but sorry that didn't work. still I am getting the extra text in the column header.

    Thanks,

    Ruchi Patel
  7. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 19 Jan Link to this post

    Hi Ruchi,

    I tried to replicate the issue on my side but I was unable to. Could you please check out the attached sample and let me know how it differs from your real setup? I would appreciate if you can replicate the issue in the attached sample and let me know how you modified it.

    Regards,
    Kostadin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. David
    David avatar
    15 posts
    Member since:
    Aug 2006

    Posted 20 Jan in reply to Ruchi Link to this post

    You may try to use the InfrastructureExporting Event on the RadGrid.  Not sure about the performance if theres many columns.

    01.Dim hrow As Telerik.Web.UI.ExportInfrastructure.Row = e.ExportStructure.Tables(0).Rows(1)
    02.        For Each hcell As Telerik.Web.UI.ExportInfrastructure.Cell In hrow.Cells
    03.            If hcell.Text.Contains("Sorted asc") Then
    04.                hcell.Value = hcell.Text.Replace("Sorted asc", "")
    05.            End If
    06.            If hcell.Text.Contains("Sorted desc") Then
    07.                hcell.Value = hcell.Text.Replace("Sorted desc", "")
    08.            End If
    09.        Next hcell

  9. David
    David avatar
    15 posts
    Member since:
    Aug 2006

    Posted 21 Jan in reply to David Link to this post

    Im sorry for the VB and formatting.  It does look like the newest release fixes this. However, if you still need it.

    Telerik.Web.UI.ExportInfrastructure.Row hrow = e.ExportStructure.Tables(0).Rows(1);
     
     
    foreach (Telerik.Web.UI.ExportInfrastructure.Cell hcell in hrow.Cells) {
     
        if (hcell.Text.Contains("Sorted asc")) {
            hcell.Value = hcell.Text.Replace("Sorted asc", "");
     
        }
     
     
        if (hcell.Text.Contains("Sorted desc")) {
            hcell.Value = hcell.Text.Replace("Sorted desc", "");
     
        }
     
    }

  10. Elena
    Elena avatar
    2 posts
    Member since:
    Oct 2012

    Posted 21 Mar Link to this post

    I updated to the latest telerik version but I'm still seeing the Sorted ascSorted desc text when I export my document.  I have turned off sorting MasterTableView.AllowSorting = false; when I hit the command but it's not working.  I even tried to overwrite the column name but it's overwriting the name but still adding the extra code.  Please help!
  11. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 24 Mar Link to this post

    Hello Elena,

    Could you please verify that you can replicate the issue from my previous reply? Additionally could you please let me know which version you are using in your project?

    Regards,
    Kostadin
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  12. Elena
    Elena avatar
    2 posts
    Member since:
    Oct 2012

    Posted 24 Mar in reply to Kostadin Link to this post

    I didn't try to replicate your issue but I tried the available fix and it wasn't working.  I tried 2 versions:  Q1 2016

    2016 1 113 40
    2016 1 315

    I ended up re-writing it and using the Spreadsheet dll.

  13. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 29 Mar Link to this post

    Hi Elena,

    I ma glad you were able to find a solution for your case. Nevertheless, if you manage to isolate the issue in a small runnable sample we will investigate it locally and provide you with a proper solution.

    Regards,
    Kostadin
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  14. Thomas
    Thomas avatar
    1 posts
    Member since:
    Jan 2016

    Posted 15 Sep Link to this post

    I've been coming across the same issue. Had to replace the column header characters to get the "Sorted ascSorted dec" text removed.

     

    Has there been any progress on a potential fix for this problem?

  15. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 20 Sep Link to this post

    Hello Thomas,

    Could you please verify that the issue could be observer with the latest version of the Telerik UI for ASP.NET. If you do I would appreciate if you can replicate the issue in a small runnable sample and send it to us for further investigation.

    Regards,
    Kostadin
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017