是IE设置的问题,具体怎样记不清了:)

解决方案 »

  1.   

    下面的程序把datagrid中的数据导入到Excel中
    public virtual void ExportToExcel(System.Web.UI.WebControls.DataGrid  dg)
    {
    Response.ContentType = "application/vnd.ms-excel";
    HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.UTF8;
    Response.Charset = "";  
    this.EnableViewState = false;
    System.IO.StringWriter tw = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
    dg.RenderControl(hw);
    Response.Write(tw.ToString());
    Response.End();
    }问题是有的系统直接打开Excel,而没有提示保存Excel,不知为何?有什么解决办法?
    是不是跟操作系统有关?