C#將html table 導出成excel實例
更新時間:2013年04月18日 10:37:30 作者:
C#將html table 導出成excel實例,需要的朋友可以參考一下
復制代碼 代碼如下:
public void ProcessRequest (HttpContext context) {
string elxStr = "<table><tbody><tr><td>1</td><td>11</td></tr><tr><td>2</td><td>22</td></tr></tbody></table>";
context.Response.Clear();
context.Response.Buffer = true;
context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToString("yyyyMMdd") + ".xls");
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
context.Response.ContentType = "application/vnd.ms-excel";
context.Response.Write(elxStr);
context.Response.End();
}
public bool IsReusable {
get {
return false;
}
}
相關文章
C# 實現(xiàn)把double 存成兩位精度小數(shù)
這篇文章主要介紹了C# 實現(xiàn)把double 存成兩位精度小數(shù),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-12-12C#中winform窗體實現(xiàn)注冊/登錄功能實例(DBHelper類)
在編寫項目時,編寫了一部分關于登錄頁面的一些代碼,下面這篇文章主要給大家介紹了關于C#中winform窗體實現(xiàn)注冊/登錄功能(DBHelper類)的相關資料,文中通過圖文介紹的非常詳細,需要的朋友可以參考下2023-06-06