把数据导出到EXCEL
把数据导出到EXCEL Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Today.Year + DateTime.Today.Month + DateTime.Today.Day + "NonAcceptanceReport1.xls"); Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "UTF-7"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-7"); this.EnableViewState = false; System.IO.StringWriter sw = new System.IO.StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); gdvNonAcceptanceReport.RenderControl(hw); gdvNonAcceptanceReport.Visible = false; Response.Write(sw.ToString()); Response.End(); 把有圖片的数据导出到EXCEL