想要导出这种格式的excel文件如何实现?
解决方案 »
- 返回前一个页面,将前一个页面的方法刷新,重新取得值,这个该如何做?
- asp.net对话框问题
- 一個很復雜的問題請教高手!謝謝~
- 谁能将下面表格生成树 分数全给 分数不够再加,问了很多次 说了很多方法 无非就是递归,个个能说可以实现,但结果并不是很客观
- net2005网站发布生成的DLL文件版本号问题
- Wizard控件的问题?CSDN高人也解决不了的问题哦~~~(非顶极高人勿进)
- 数据连接怎么回事呢?
- .net mvc 两列运算产生新列,lambda怎么写
- 关于ViewState问题?
- 如何设置模版列的头文本(HeaderText)(急!!!)
- 问一个SQL查询的基础问题
- 求高手帮忙 解析一个字符串?
ContentType: application/ms-excel;
还有
Content-Disposition:attachment;filename=file.xls
{
mytable.Columns[12].Visible = false;
mytable.Columns[13].Visible = true;
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=MemberDetail.xls");
HttpContext.Current.Response.Charset = "GB2312";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType = "application/ms-excel";
ctl.Page.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
}调用DGToExcel(mytable); //直接导出datagrid控件
.NET导出Excel高手,有什么问题可找我QQ104481987,[email protected]
http://blog.csdn.net/ranshouxu/article/details/8705529
{
mytable.Columns[12].Visible = false;
mytable.Columns[13].Visible = true;
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=MemberDetail.xls");
HttpContext.Current.Response.Charset = "GB2312";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType = "application/ms-excel";
ctl.Page.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
}