解决方案 »

  1.   

    http://bbs.csdn.net/topics/390796988
    http://bbs.csdn.net/topics/390780207
    发帖两次,未解决.......
      

  2.   

    试试  下边的代码GridView gv = new GridView();  
                            gv.DataSource = dtError;  
                            gv.DataBind();  
                            gv.Attributes.Add("style", "vnd.ms-excel.numberformat:@");  
      
                            HttpResponse hResponse = this.Response;  
                            string fileName1 = "新员工格式验证错误统计" + DateTime.Now.ToString("yyyyMMdd");  
      
                            hResponse.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName1, System.Text.Encoding.UTF8) + ".xls");  
                            hResponse.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");  
                            hResponse.ContentType = "application/ms-excel";  
                            this.EnableViewState = false;  
      
                            StringWriter tw = new StringWriter();  
                            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);  
                            gv.RenderControl(hw);  
      
                            hResponse.Write(tw);  
                            hResponse.End();
      

  3.   

    你的方法我试过的呀。
    http://bbs.csdn.net/topics/390796988  见 3 楼是不是不兼容的缘故呢?
      

  4.   

    你安装的win7是ghost 版的吧,如果是,里面集成是的office2007版本的,你原来是office2003版本,肯定打不开的。建议你把office2007删除,重新安装office2003.试试看。
      

  5.   

    你的方法我试过的呀。
    http://bbs.csdn.net/topics/390796988  见 3 楼是不是不兼容的缘故呢?
    弹出下载框是什么样子的?、要用IE下载
      

  6.   

    是 win7  Ghost 版的     公司现在都是 office 2007  的    (总不能全部都要安装2003吧)   之前是 office 2003  就没有问题  ,
    有啥好的办法可以解决吗?
      

  7.   

    你的方法我试过的呀。
    http://bbs.csdn.net/topics/390796988  见 3 楼是不是不兼容的缘故呢?
    弹出下载框是什么样子的?、要用IE下载
    弹出框如下
    保存后 打开的样子 如下:
    http://bbs.csdn.net/topics/390780207
      

  8.   


       public static void DGToExcel(Control ctl, string fileName)
            {
                HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename="+fileName);
                HttpContext.Current.Response.Charset = "";
                HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
                HttpContext.Current.Response.ContentType = "application/ms-excel";
                ctl.Page.EnableViewState = false;
                StringWriter tw = new StringWriter();
                HtmlTextWriter hw = new HtmlTextWriter(tw);
                ctl.RenderControl(hw);
                HttpContext.Current.Response.Write(tw.ToString());
                HttpContext.Current.Response.End();
            }修改一下编码方式解决乱码问题
      

  9.   

    让你测试是不是office版本引起的问题无语了
      

  10.   

    BOM  物料清单 ?   这个有啥用呀?  不懂耶....
      

  11.   

    你导出的是2003格式的
    win7上默认的是office2007,要打开2003的文档,需要安装office2007兼容性组件
      

  12.   

    BOM  物料清单 ?   这个有啥用呀?  不懂耶....BOM =  ByteOrderMarking