就用这个吧,我就用的。
很好的。
<SCRIPT language="vbscript">
<!--
Function saveToExcel()
Set objXL = CreateObject("Excel.Application")
objXL.Visible = True
objXL.WorkBooks.Add()
Set objTB = document.all("dgdDetail")
For x=1 To objTB.rows.length
For y = 1 To objTB.rows(x-1).cells.length
objXL.Cells(x,y).value = objTB.rows(x-1).cells(y-1).innerTEXT
Next
Next
End Function
//-->
</SCRIPT>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;