2006/04/06

教學:如何將datagrid匯出Excel在client side!

1.首先,將DB裡面的資料撈出來放在datagrid裡面!
2.將下面的程式COPY 使用之!!即可response成Excel在client side摟!
*******************************
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
DataGrid1.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
*******************************

標籤: ,

0 Comments:

張貼留言

<< Home