Export from gridgroupingcontrol not exported as numeric
Thank you for contacting Syncfusion Support.
If you want to export the Numeric value to the excel, it can be achieved by setting the CellValueType of particular column. If the CellValueType is not specified for the columns, it takes the data on it’s as the general type or text. Therefore the numeric value is also treated like the string while exporting. if you want to display the exported value as Numeric, need to set the CellValueType in the GridGroupingControl or while creating the data source specify the Column value type as double (or) int.
If you are using whole table as the numeric value then you can set the CellValueType of the table as follows,
Code Snippet:
//Set the CellValue type for Grid
this.gridGroupingControl1.Appearance.AnyRecordFieldCell.CellValueType = typeof(double);
//Set the CellValueType for particular column which is want to be exported as Numeric
this.gridGroupingControl1.TableDescriptor.Columns["ColumnName"].Appearance.AnyRecordFieldCell.CellValueType = typeof(int);
KB Link:
http://www.syncfusion.com/kb/691/How-to-move-the-contents-of-GridGroupingControl-to-Excel
Sample:
http://www.syncfusion.com/downloads/support/forum/120233/ze/ExportToExcel1506606008
Regards,
Adhi
Thanks for your update.
We were unable to reproduce the issue at our end. It might be caused by the use of different Converter for exporting. Instead, use the GroupingGridExcelConverterControl to export the columns with the decimal values. Please refer to the following code example,
Code Example:
private void button1_Click(object sender, EventArgs e)
{
//Create Converter for exporting
GroupingGridExcelConverterControl converter = new GroupingGridExcelConverterControl();
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Files(*.xls)|*.xls";
saveFileDialog.DefaultExt = ".xls";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
//Export the Grid to excel
converter.GroupingGridToExcel(this.gridGroupingControl1, saveFileDialog.FileName, Syncfusion.GridExcelConverter.ConverterOptions.Default);
if (MessageBox.Show("Do you wish to open the xls fnnile now?", "Export to Excel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Process proc = new Process();
proc.StartInfo.FileName = saveFileDialog.FileName;
proc.Start();
}
}
}
Sample:
http://www.syncfusion.com/downloads/support/forum/120233/ze/ExportToExcel_(3)-1130548645
If you are still facing the same problem, please let me know your product version of Essential studio.
Regards,
Adhi
Thanks for your update.
We have analyzed your reported scenario at our end. But we were unable to reproduce the issue. Please provide the detailed description of that issue, It will be more helpful for us to provide the prompt solution.
Regards,
Adhi.
- 5 Replies
- 2 Participants
-
RA Rem Aza
- Sep 12, 2015 08:14 AM UTC
- Sep 18, 2015 04:00 AM UTC