通过Response.Write的方法输出CSV的文本文件
StringBuilder objCSV = AnalysisLayer.LoadChargeInfoToCSVString(ViewStateFrom, ViewStateTo, GenerateSortString());
string strFile = Server.MapPath("mygod.csv");
Response.Clear();
Response.Buffer = true;
Response.Charset = "utf-8";
Response.AppendHeader("content-disposition", "attachment;filename=VocieLog.csv");
Response.ContentEncoding = System.Text.Encoding.Default;
//response.contenttype指定文件类型 能为application/ms-excel || application/ms-word || application/ms-txt || application/ms-html || 或其他浏览器可直接支持文件
Response.ContentType = "application/ms-txt";
this.EnableViewState = false;
Response.Write(objCSV.ToString());
Response.End();
浙公网安备 33010602011771号