Dear all,
I am currently facing the following issue with a data in an MVC5 application. The values displayed in the grid when running the application are fine (screen capture 1). However, once exported the values appear to have been modified during export (screen capture 2). Ideally, the value displayed in the grid should be exported to the Excel file as is. I came across the following post here in the community forum, but I am not if that is the key to resolving my present issue. Would be grand if someone could be of assistance regarding this matter.
This is the basic setup of the grid I am currently using
<div class="gridview">
@{
List<object> cols = new List<object>();
cols.Add(new { field = "SomeFieldName", direction = "Descending" });
}
@Html.EJS().Grid("Grid").Locale("de").DataSource((IEnumerable<object>)ViewBag.DataSource).Height(500).Width("100%").ToolbarClick("toolbarClick").AllowSorting().AllowFiltering(true).AllowReordering().AllowResizing(true).Columns(col =>
{
col.Field("SomeFieldName01").HeaderText("ColName01").Add();
col.Field("SomeFieldName02").HeaderText("ColName02").Format("dd.MM.yyyy HH:mm:ss").Add();
col.Field("SomeFieldName03").HeaderText("ColName03").Format("C2").Add();
col.Field("SomeFieldName04").HeaderText("ColName04").Add();
col.Field("SomeFieldName05").HeaderText("ColName05").Add();
col.Field("SomeFieldName06").HeaderText("ColName06").Add();
col.Field("SomeFieldName07").HeaderText("ColName07").Format("C2").Add();
col.Field("SomeFieldName08").HeaderText("ColName08").Format("C2").Add();
col.Field("SomeFieldName09").HeaderText("ColName09").Add();
col.Field("SomeFieldName10").HeaderText("ColName10").Add();
}).AllowPaging().DataBound("dataBound").Toolbar(new List<string>() { "ExcelExport" }).AllowExcelExport(true).SortSettings(sort => sort.Columns(cols)).Render()
</div>
function toolbarClick(args) {
var gridInstance = document.getElementById("Grid").ej2_instances[0];
if (args.item.text === 'Excel Export') {
gridInstance.excelExport();
}
}
sc01_02.png = Values being displayed correctly in the grid
sc02_02_excel.PNG = Exported values with incorrect number format.
Thanks a mil in advance for any help provided.
Kind regards
Chris
Attachment:
images_8eae9568.zip