We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

String/Number format problem when exporting data using GridToExcel

Thread ID:





88501 Jul 27,2009 03:36 PM UTC Jul 31,2009 01:46 PM UTC WinForms 1
Tags: GridControl
Mia Cheng
Asked On July 27, 2009 03:36 PM UTC


I have a test.xls with
Cell("A1") = 10
Cell("A2") = 20
Cell("A3") is a formula = AVERAGE("A1","A2")
In MS EXCEL, Cell("A3") = 15 of course

when I use ExcelToGrid to import the excel
and edit the "A1" cell to be any number like 2
and use GridToExcel to save the grid content back to orig excel worksheet, Cell("A3") would become "Devided by zero".
And all three cell has some error, I have to using "Convert to Number" to correct it and get correct value.

Is it the conversion of cell format affect the result?
Or how should I do to get a correct xls back after I save from grid?

Thanks in advance.

Rajadurai C [Syncfusion]
Replied On July 31, 2009 01:46 PM UTC

Hi Mia,

Thanks for your interest in Syncfusion Products.

While exporting the grid values to excel sheet, all get exported as string type by default. If you would like to export the values with the type it holds in the excel sheet, please try to handle the QueryImportExportCellInfo event with the following code.

void gecc_QueryImportExportCellInfo(object sender, Syncfusion.GridExcelConverter.GridImportExportCellInfoEventArgs e)
if (e.Action == Syncfusion.GridExcelConverter.GridConverterAction.Export)
e.ExcelCell.Value = e.GridCell.Text;
e.Handled = true;

Here is a sample for your reference.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon