asp.net - C# Response.Write CSV file not splits the cells -


i have code:

    context.response.clearheaders();     context.response.addheader("content-disposition", "attachment; filename=clients.csv");     context.response.clearcontent();     context.response.contenttype = "application/ms-excel";     context.response.contentencoding = system.text.encoding.unicode;     context.response.binarywrite(system.text.encoding.unicode.getpreamble());     context.response.bufferoutput = false;     context.response.buffer = false;      foreach (var c in clients)     {         context.response.output.writeline(string.format("{0},{1}", c.firstname, c.lastname));     } 

the downloaded file looks fine, except fact row cells merged 1 cell. must use response binarywrite because of hebrew , japan characters in csv/xls content. how write splitted cells csv/xls file binary write?

to quote wikipedia:

microsoft excel open .csv files, depending on system's regional settings, it may expect semicolon separator instead of comma, since in languages comma used decimal separator.

so although called comma separated values, think should give try using semicolons instead of commas.

i.e. use:

context.response.output.writeline(     string.format("{0};{1}", c.firstname, c.lastname)); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -