请教各位高手:DataGrid 导出Excel为什么在有的计算机上Excel嵌在IE中,有的计算机却直接打开在客户端Excel并将数据写入!!???
请教高手:DataGrid 导出Excel为什么在有的计算机上Excel嵌在IE中,有的计算机却直接打开在客户端Excel并将数据写入!!???,到底怎样才能直接打开在客户端Excel并将数据写入!!??.
下面是我到处Excel的代码,请各位指点!
this.Table1 .DataBind ();
Response.ContentType = "application/vnd.ms-excel" ;
Response.Charset = "" ;
Response.AddHeader("Content-Disposition", "filename=Logs.xls");
this.EnableViewState = false ;
System.IO.StringWriter tw = new System.IO.StringWriter() ;
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw) ;
Table1.RenderControl( hw ) ;
hw.Flush() ;
Response.Write( tw.ToString() ) ;
Response.End() ;
hw.Close() ;
tw.Close() ;