html table 轉 excele
//result : html table 字串
private void OutPutExcel(string result) {
Response.Clear();
Response.Buffer = true;
Response.Charset = "Big5";
Response.AppendHeader("Content-Disposition", "attachment;filename=report.xls");
// 如果設置为 GetEncoding("GB2312");導出的文件將會出現亂碼!!!
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "application/ms-excel";//設置輸出文件類型为excel文件。
Response.Write(@"<html><head><meta http-equiv=Content-Type content=""text/html; charset=utf-8""></head><body>");
Response.Write(result);
Response.Write("</body></html>");
Response.Flush();
Response.End();
}
標籤: C#
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁