省前略後~最主要就是~加上紅色部分~
Response.AddHeader("content-disposition", "attachment;filename=" + DateTime.Now.Ticks + ".xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=utf-8>");
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
for (int i = 0; i < gvExcel.Rows.Count; i++)
{
gvExcel.Rows[i].Attributes.Add("class", "textmode");
}
沒有留言:
張貼留言