Hello. I have a question that I can't understand.
I am exporting several similar datagrids (they all have the "netprice" column) and in their columns there is one that is of type "currency" and the Excel result in some cases is text and others of the correct type, which is currency.
The difference is between these two cases:
1-
public double? NetPrice { get; set; }
Result: (not sum !!! ? why????)
2-
public int NetPrice { get; set; }
Result:
This is the columns add for the cols:
Why is the result different if both columns are numeric (int & double)?
Is it possible to solve it or should I use the export events to format or is it not necessary?
``private void Options_CellExporting(object sender, DataGridCellExcelExportingEventArgs e)
{
if (e.CellType == ExportCellType.RecordCell)
{
if (e.ColumnName is "PriceNet")
{
// ???????
}
}
}
*another question:
I have some columns that do not show data from the observable list but that I modify through:
if(list.Name == "next")
e.DisplayText = "hello";
I need the excel column to show "hello" and not "next" in the exported excel result. Any idea how to do it?
Hi Sergio,
Thanks for contacting Syncfusion support.
In EJ2 Grid, all the data actions like formatting, sorting, filtering, etc.,
are performed based on the column’s field name and its type. We suggest you to
manually set the column type as number which will resolve this.
columnType: https://ej2.syncfusion.com/documentation/api/grid/columnType/
{ field: 'Cost', type: 'number', width: 140, format: 'N', }
|
sample: https://stackblitz.com/edit/otvxpw?file=index.js
Still, if you face the same issue kindly share the below details to validate
further.
By using excelQueryCellInfo event, you can customize the value
before exporting the data.
excelQueryCellInfo: https://ej2.syncfusion.com/javascript/documentation/api/grid/#excelquerycellinfo
if (args.column.field == 'ShipCountry') { args.value = 'Hello'; } }
|
Regards,
Rajapandiyan S
If this post is helpful, please consider Accepting it as the solution so that
other members can locate it more quickly.
the question is for winform+sfdatagrid not js...
Hi Sergio,
We have checked the reported issue on our end. But we are unable to reproduce the reported issue, here we have attached the tested sample for your reference. In that, we have exported the grid which contains two different currency columns with different datatypes as you mentioned. The summaries are exported properly as expected. Please have a look at this, if you still facing the reported issue please modify the attached sample based on your scenario. Or if we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further.
Regards,
Dhanasekar M.
e.ExportMode = ExportMode.Text;