HI,
I have a data grid from which I am exporting data to excel. Note that the regional settigns I am using is of Denmark(danish) and when I try to export data the value2 property always removes the decimal point(.) and makes it as continous string. That is, if I have value 123.0.1.0 it will convert to 123010 which is not expected. One more issue is, when I have some date string ex "01-01-2000" and I export the value2 shows it as some junk value and same appears in excel. This is really eating my time to fix the issue.
Is this some thing related to regional setting, if yes then need a solution to which makes it to work irrespective of cultural settings.
Pasted piece of code which I am looking into,
Note: Here valueObj is object
if (dataType != null && dataType.ToString().Contains("System.DateTime"))
{
iRange.Value2 = valueObj;
iRange.CellStyle.NumberFormat = this._DateTimeFormatTables;
}
else
{
iRange.Value2 = valueObj;
iRange.NumberFormat = ExcelFormatType.General.ToString();
}
I tried using value instead of Value2, but no use.
Need help ASAP.