functionscope / Node-Excel-Export

A simple node.js module for exporting data set to Excel xlsx file.
492 stars 269 forks source link

C# HttpResponseMessage - File download as Excel doesn't preserve column data #60

Open LotusShiv opened 7 years ago

LotusShiv commented 7 years ago

Hi. I am able to download with HttpResponseMessage and setting all header params and such as shown here in code extract....

downloadHttpResp.Content = new ByteArrayContent(dwlMemStream.ToArray()); //******************************************************************************* downloadHttpResp.Content.Headers.Add("x-filename", fileName); downloadHttpResp.Content.Headers.ContentType = new MediaTypeHeaderValue(mimeType); downloadHttpResp.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); downloadHttpResp.Content.Headers.ContentDisposition.FileName = fileName;

Issue is with one of the columns - which is just a text column (but the download and open treats it like a date column). For e.g. I have multiple row-column value occurrences as 11 - 05, when the download occurs, whether I save or open in Excel, it converts to Nov 05 (like as if its a date). How do I get around this? Is there any other way to overcome, or if some header option/setting that I can set will preserve the data as is and no conversion to be done on the receiving end?

Thanks