/// <summary>
/// 重写的方法用于导出隐闷Word或者Excel文档
/// </summary>
/// <param name="control"></param>
public override void VerifyRenderingInServerForm(Control control)
{
// Confirms that an HtmlForm control is rendered for
}
protected void btnGoToFile_Click(object sender, EventArgs e)
{
Button btn = sender as Button
Response.Clear()
Response.Buffer = true
Response.Charset = "utf-8"
Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8") //设置输出流为简体中文
if (btn.CommandName == "toWord")
{
Response.AppendHeader("Content-Disposition", "attachmentfilename=DengLuRiZhi.doc") //保存的文件为DengLuRiZhi.doc
Response.ContentType = "application/ms-word"//设置输出文件为word文件
}
else if (btn.CommandName == "toExcel")
{
Response.AppendHeader("Content-Disposition", "attachmentfilename=DengLuRiZhi.xls") //保存的文件为DengLuRiZhi.xls
Response.ContentType = "application/ms-excel" //设置输出文件类型为excel文件。
}
this.EnableViewState = false
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true)
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad)
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter)
this.GVLoginLogInfo.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
}
update table set id="'"+id这样把access的表中的身份z列的数据前面加多一个扒森'
导烂圆出excel就可以是文本的方式,不以科学记数的方式了春历亩。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)