使用GridView 輸入成Excel 轉成 Excel 檔(C#)
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Button2_Click(object sender, EventArgs e) { GridViewToExcel(GridView1,false); } protected void GridViewToExcel(GridView GV ,bool flag) { GV.AllowPaging = flag; Response.ClearContent(); Response.Write("<meta http-equiv=Content-Type content=text/html;charset=utf-8>"); string excelFileName = "測試Excel檔案.xls"; Response.AddHeader("content-disposition", "attachment;filename=" + Serve...