帮我解释一下 10
//点击导出按钮时protectedvoidButton1_Click(objectsender,EventArgse){Button2_Click(sender,e);...
//点击导出按钮时
protected void Button1_Click(object sender, EventArgs e)
{
Button2_Click(sender, e);
Export("application/ms-excel", "计划查询" + datetime1.Text + "-" + datetime2.Text + "报表.xls");
}
protected string Export(string FileType, string FileName)
{
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Buffer = true;
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=GB2312>");
Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.ContentType = FileType;
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView gv = new GridView();
if (str == "scy")
{
gv = ScYearGridView;
}
else if (str == "scm")
{
gv = ScMonthlyGridView;
}
else if (str == "xsy")
{
gv = XsYearGridView;
}
else
{
gv = XsMonthlyGridView;
}
gv.Columns[0].Visible = false;
gv.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
return "";
}
//如果没有下面方法会报错类型“GridView”的控件“GridView1”必须放在具有 runat=server 的窗体标记内
public override void VerifyRenderingInServerForm(Control control)
{
} 展开
protected void Button1_Click(object sender, EventArgs e)
{
Button2_Click(sender, e);
Export("application/ms-excel", "计划查询" + datetime1.Text + "-" + datetime2.Text + "报表.xls");
}
protected string Export(string FileType, string FileName)
{
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Buffer = true;
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=GB2312>");
Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.ContentType = FileType;
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView gv = new GridView();
if (str == "scy")
{
gv = ScYearGridView;
}
else if (str == "scm")
{
gv = ScMonthlyGridView;
}
else if (str == "xsy")
{
gv = XsYearGridView;
}
else
{
gv = XsMonthlyGridView;
}
gv.Columns[0].Visible = false;
gv.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
return "";
}
//如果没有下面方法会报错类型“GridView”的控件“GridView1”必须放在具有 runat=server 的窗体标记内
public override void VerifyRenderingInServerForm(Control control)
{
} 展开
4个回答
展开全部
你在问什么
追问
这不是个把数据导到 excel表格的功能吗? 主要想让你给我大概翻译一下
追答
你去搜索vnr,代码翻译就好了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
解释什么?
追问
这不是个把数据导到 excel表格的功能吗? 主要想让你给我大概翻译一下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
啊????什么,看不懂
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询