這篇文章主要介紹“如何解決asp.net導(dǎo)出Excel顯示中文亂碼的問題”,在日常操作中,相信很多人在如何解決asp.net導(dǎo)出Excel顯示中文亂碼的問題問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”如何解決asp.net導(dǎo)出Excel顯示中文亂碼的問題”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!
創(chuàng)新互聯(lián)建站主要從事成都做網(wǎng)站、成都網(wǎng)站設(shè)計、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)依蘭,十余年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108復(fù)制代碼 代碼如下:
protected void btnExcel_Click(object sender, EventArgs e)
{
List
string filename = "3g流量網(wǎng)齡升級計劃用戶表";
string name1 = filename;
string bname = Common.MyRequest.GetBrowserName().ToLower();
if (bname.Contains("firefox"))
{
}
else if (bname.Contains("ie"))
{
filename = HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8);
}
else
{
filename = HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8);
}
HttpResponse resp = System.Web.HttpContext.Current.Response;
resp.Charset = "utf-8";
resp.Clear();
resp.AppendHeader("Content-Disposition", "attachment;filename=" + filename + ".xls");
resp.ContentEncoding = System.Text.Encoding.UTF8;
resp.ContentType = "application/ms-excel";
string style =""+ "";
resp.Write(style);
//resp.Write(ExportTable(list));
resp.Write("
" +"手機"+ " | " + "渠道" + " | " +"時間" + " |
---|---|---|
" + model.phone + " | ");" + model.qudao + " | ");" + model.tm + " | ");