This is a migrated thread and some comments may be shown as answers.

Output to Excel Error

2 Answers 390 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Silviu
Top achievements
Rank 1
Silviu asked on 01 Dec 2016, 03:39 PM

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 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 06 Dec 2016, 01:19 PM
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.
0
Paolo
Top achievements
Rank 1
answered on 13 Oct 2017, 01:09 PM
once again a workaround for basic functionality
Tags
Grid
Asked by
Silviu
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Paolo
Top achievements
Rank 1
Share this question
or