c# - No quotef for first value in csv -


i trying make simple csv file, works except 1 tiny thing : when file opened in excel, first value of each entry isn't quoted, e.g :

username,"fullname","fullname@company.com" 

and here code :

stringbuilder sb = new stringbuilder();  // user info foreach (user u in listusers) {     sb.appendformat("\"{0}\",\"{1}\",\"{2}\"\r\n", u.username, u.fullname, u.email); }  // generate csv response.clear(); response.contenttype = "text/csv"; response.addheader("content-disposition", "attachment; filename=\"" + "usersexport.csv" + "\""); response.write(sb.tostring()); response.end(); 

any idea?


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -