[問題] datagrid export Excel 如何加匯出時間
大家好,我的匯出code是從網路上找來,
也可以將datagrid export to Excel,
但user希望在excel表的第一個row
顯示會出的資料名和匯出時間,
請問我如何才可以新增一個row放資料名和匯出時間?
我是用VS2003 c#
private void toExcel_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
string attachment = "attachment; filename=Contacts.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
// Create a form to contain the grid
HtmlForm frm = new HtmlForm();
dgService.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(dgService);
frm.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.45.130.128
→
05/29 10:23, , 1F
05/29 10:23, 1F
→
05/29 13:32, , 2F
05/29 13:32, 2F
→
05/29 13:32, , 3F
05/29 13:32, 3F
→
05/29 13:42, , 4F
05/29 13:42, 4F
→
05/29 14:33, , 5F
05/29 14:33, 5F