Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LotusShiv opened this issue Jul 10, 2017 · 0 comments

Comments

@LotusShiv
Copy link

LotusShiv commented Jul 10, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant