我想網格視圖的內容轉換到Excel文件 ,我使用此代碼網格視圖的Excel
string attachment = "attachment; filename= " + FileName;
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gv.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
做
問題是我得到在某種形式的html excel樣式格式,在頁面鏈接等theres java腳本 我想要的是將我的查詢結果轉換爲逗號分隔文件 是否可以免費或我必須運行查詢自己獲取數據和寫出一個csv流 謝謝