手机
当前位置:查字典教程网 >编程开发 >C#教程 >C#将html table 导出成excel实例
C#将html table 导出成excel实例
摘要:复制代码代码如下:publicvoidProcessRequest(HttpContextcontext){stringelxStr="11...

复制代码 代码如下:

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实例】相关文章:

C# 汉字转拼音(全拼和首字母)实例

C#反射在实际应用中的实例代码

C#制作鹰眼的详细全过程(带注释)实例代码

C# 手动/自动保存图片的实例代码

c#简单读取文本的实例方法

C#控制台输出进度和百分比的实例代码

c# 值类型实例构造器

c# 获得局域网主机列表实例

c# 图片加密解密的实例代码

C#加密在实际中的应用

精品推荐
分类导航