在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
平台 ASP.NETthis.Response.Clear(); this.Response.Charset = "GB2312"; this.Response.ContentEncoding = Encoding.GetEncoding("GB2312"); this.Response.AddHeader("Content-Disposition",String.Format("attachment; filename=file-{0}.csv",DateTime.Now.ToShortDateString())); this.Response.ContentType = "application/vnd.ms-excel"; string[] columns = { "序号", "姓名", "手机号码", "电子邮箱", "省份", "城市", "地区" }; const string csv = "1,2,3"; var builder = new StringBuilder(); builder.AppendLine(String.Join(",",columns)); builder.AppendLine(csv); this.Response.Write(builder); this.Response.End();
|
请发表评论