Output to Excel Error

3 posts, 0 answers
  1. Silviu
    Silviu avatar
    63 posts
    Member since:
    Feb 2015

    Posted 01 Dec 2016 Link to this post

    I have a RadGrid created dynamically in code behind and when I try to export to Excel I get the following error:

    We found a problem with this formula. Try clicking Insert Function on the Formulas tab to fix it.\n\nNot trying to type a formula? When the first character is an equal (=) or minus (-) sign, RadSpreadsheet thinks it is a formula. For example, when you type =1+1 the cell shows 2.

    Here is the export code:

    protected void ibtnExportToExcel_Click(object sender, ImageClickEventArgs e)
            {
                rgWorkItems.DataSource = Session["GridTable"];
                rgWorkItems.Rebind();
                rgWorkItems.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
                rgWorkItems.ExportSettings.IgnorePaging = true;
                rgWorkItems.ExportSettings.ExportOnlyData = true;
                rgWorkItems.ExportSettings.OpenInNewWindow = true;
                rgWorkItems.MasterTableView.ExportToExcel();         
            }

    I do not have any of the data that starts with = in my grid.

    If I change the ExportToExcel to ExportToCSV it works just fine.

    How can I resolve this?

  2. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 06 Dec 2016 Link to this post

    Hello Silviu,

    A possible solution is to set text format to the cell in order to stop recognizing it as a formula. Please check out the following code library which demonstrates how to apply format.
    cell.Format = "@";


    Regards,
    Kostadin
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
  3. Paolo
    Paolo avatar
    1 posts
    Member since:
    Jan 2014

    Posted 13 Oct 2017 Link to this post

    once again a workaround for basic functionality
Back to Top