导出到Excel如何全屏显示 [英] Export To Excel How To dispaly full screen

查看:157
本文介绍了导出到Excel如何全屏显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Developers,


在导出到Excel时如何在asp.net中显示全屏Excel工作表.

感谢前进

Aravind G

Hi Developers,


While Export To Excel How To dispaly full screen excel sheet in asp.net .

Thanks For Advance

Aravind G

推荐答案

在您的页面指令中,将< code> EnableEventValidation ="false"</code>

< pre lang ="c#">公共无效ExportGridExel()
{
字符串附件=附件;文件名= EstablishmentAllotmentDetail.xls";
Response.ClearContent();
Response.AddHeader("content-disposition",附件);
Response.ContentType ="application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw =新的HtmlTextWriter(sw);
HtmlForm frm =新的HtmlForm();
如果(trAllotmentDetail.Visible == true)
{
pnlGrid.Parent.Controls.Add(frm);
frm.Controls.Add(pnlGrid);
}
如果(trAllotmentDetailDivision.Visible == true)
{
pnlDivision.Parent.Controls.Add(frm);
frm.Controls.Add(pnlDivision);
}
frm.Attributes ["runat"] =服务器";
frm.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}</pre>

< pre>< pre lang ="c#"></pre>公共重写void VerifyRenderingInServerForm(Control control)
{
/*验证控件是否已呈现*/
}
</pre>
In your page directive put <code>EnableEventValidation="false"</code>

<pre lang="c#"> public void ExportGridExel()
{
string attachment = "attachment; filename=EstablishmentAllotmentDetail.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
HtmlForm frm = new HtmlForm();
if (trAllotmentDetail.Visible == true)
{
pnlGrid.Parent.Controls.Add(frm);
frm.Controls.Add(pnlGrid);
}
if (trAllotmentDetailDivision.Visible == true)
{
pnlDivision.Parent.Controls.Add(frm);
frm.Controls.Add(pnlDivision);
}
frm.Attributes["runat"] = "server";
frm.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}</pre>

<pre><pre lang="c#"></pre>public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
</pre>


这篇关于导出到Excel如何全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆