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#将html table 导出成excel实例相关文章请关注php中文网!
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号