While using the ExcelWriter to export dates I get this results:
ger: 10.09.2015 - > in Excel : 10092015 (Points are replaced, no date format)
eng: 09/10/2015 → in Excel: 09/10/2015 (no date format)
Any Solutions ? Thx for your help.
public HttpResponseMessage dhtmlxGridExcel()
var generator = new ExcelWriter();
var xml = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.Form[“grid_xml”]);
MemoryStream excel = generator.Generate(xml);
HttpResponseMessage result = Request.CreateResponse(HttpStatusCode.OK);
result.Content = new ByteArrayContent(excel.GetBuffer());
result.Content.Headers.ContentType = new MediaTypeHeaderValue(generator.ContentType);
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
result.Content.Headers.ContentLength = excel.Length;
result.Content.Headers.ContentDisposition.FileName = "Grid" + ".xlsx";
unfortunately currently there is no good way for managing cell types and formatting with our export tool.
Although, you can get some control of it after modifying the source codes of the export library.
If you find ExcelWriter.rowsPrint, you can see where the values from the grid are put into cells of the result spreadsheet:
At that point the code has no info of actual column types, but you can try parse cell values into numbers or DateTimes. Cell formatting will be applied after the type you assign into the cell:
Note that the parsing will be done according to server culture and globalization settings, you may want to specify them explicitly either in .TryParse call, or in web config stackoverflow.com/questions/1100 … balization
Here is a demo project with the modified version of an export library
s3.amazonaws.com/uploads.hipcha … elMVC5.zip
Can I get a copy of that zip file please. I want to try and get the formatting of numbers and dates right in the excel export.
Hi @gmax ,
surprisingly enough, I was able to find that example.
Here is a working link:
it was made 3 years ago so I’m not sure whether any migration will be needed in order to run it in the latest VisualStudio