我在服务器2003上运行我的c# 程序,导出excel,我用的是office 2007版本,导入的时候没有问题,导出的时候就会报下面的错误:Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. • To make more memory available, close workbooks or programs you no longer need. • To free disk space, delete files you no longer need from the disk you are saving to. 
请帮忙看看是什么问题。我用office的时候没有任何问题,自从换了office 2007之后就有问题了。

解决方案 »

  1.   

    2个excel不兼容,建议你都换成2003,你的内存的存储地址空间不足,打开一个excel后要关掉它
      

  2.   

    2个excel不兼容,建议你都换成2003,你的内存的存储地址空间不足,生成一个excel后要关掉它
      

  3.   

    Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. • To make more memory available, close workbooks or programs you no longer need. • To free disk space, delete files you no longer need from the disk you are saving to. Excel文档不能再打开或保存,因为没有足够可用的内存或硬盘,增加一些可用内存空间,关掉你不再需要的程序或文件。清理硬盘空间,删除一些你不再需要的文件。
    ---这是我自己理解给你的翻译
      

  4.   

    是不是没权限
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
      

  5.   

    我感觉应该是你office版本的问题!
      

  6.   

    我也知道是office版本问题,但是怎么解决呢?高手请指教指教啊!
      

  7.   

    我的程序如下:
    log.Info("************** outputexcel ****************");
            Microsoft.Office.Interop.Excel.Application oXL=null;
            Microsoft.Office.Interop.Excel.Workbook oWB=null;
            Microsoft.Office.Interop.Excel.Worksheet oSheet=null;
            Microsoft.Office.Interop.Excel.Range oRng=null;        string filepath = Server.MapPath(".") + "\\file";        DateTime dt1 = System.DateTime.Now;
            string filename = "Inventory_" + dt1.ToString("yyyyMMddHHmmssffff") + ".xlsx";
            string path = filepath + "\\" + filename;
            try
            {
                log.Info("************** 0 ****************");
                // GC.Collect(); 
                //创建一个excel的应用对象
                oXL = new Microsoft.Office.Interop.Excel.ApplicationClass();
                
                oXL.Visible = false;
                log.Info("************** 00 ****************");
                //创建一个新的workbook
                oWB = (Microsoft.Office.Interop.Excel.Workbook)(oXL.Workbooks.Add(true));            log.Info("************** 000 ****************");            oSheet = (Microsoft.Office.Interop.Excel.Worksheet)oWB.ActiveSheet;
                //在特定的单元格中填入内容
                oSheet.Cells[1, 1] = "物料";
                oSheet.Cells[1, 2] = "物料描述";
                oSheet.Cells[1, 3] = "库存数量";            log.Info("************** 0000 ****************");
                //格式化A1到E1范围内文字的大小为"9",字体为"粗字体",对齐方式为"中间对齐"
                oSheet.get_Range("A1", "C1").Font.Size = 9;
                oSheet.get_Range("A1", "C1").Font.Bold = true;
                oSheet.get_Range("A1", "C1").VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
                //该范围内设置外面一层边框            oSheet.get_Range("A1", "C1").BorderAround(Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous, Microsoft.Office.Interop.Excel.XlBorderWeight.xlThin, Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic, 3);            //该范围内设置里面所有单元格的边框
                oSheet.get_Range("A1", "C1").Borders.Weight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThin;
                oSheet.get_Range("A1", "C1").Borders.Color = 4;            //合并该范围内的所有单位格为一个单元格
                //oSheet.get_Range("A1","D1").Merge(true) ;            //范围内单元格自动适应文字的长短
                oRng = oSheet.get_Range("A1", "C1");
                oRng.EntireColumn.AutoFit();            //范围内单元格添加背景颜色
                //Color.LightGray.ToArgb()
                //oSheet.get_Range("A1", "L1").Cells.Interior.Color = 1;
                oSheet.get_Range("A1", "C1").Cells.Interior.Pattern = Microsoft.Office.Interop.Excel.XlBackground.xlBackgroundAutomatic;
                oXL.ActiveCell.NumberFormatLocal = "@";
                log.Info("************** 1 ****************");
                string sql = getsql();
                SqlDataAdapter adapter = new SqlDataAdapter(sql, mycon);
                DataSet inventory_ds = new DataSet();
                adapter.Fill(inventory_ds, "inventory_ds");
                System.Data.DataTable dt = inventory_ds.Tables[0];            for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    oSheet.Cells[i + 2, 1] = "'" + dr[0].ToString();
                    oSheet.Cells[i + 2, 2] = dr[1].ToString();
                    oSheet.Cells[i + 2, 3] = dr[2];            }
                int c = dt.Rows.Count;
                c = c + 1;
                string endCell = c.ToString();
                endCell = "C" + endCell;
                oSheet.get_Range("A2", endCell).Font.Size = 9;
                oRng = oSheet.get_Range("A2", endCell);            oRng.Borders.get_Item(Microsoft.Office.Interop.Excel.XlBordersIndex.xlInsideVertical).LineStyle
                    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                oRng.Borders.get_Item(Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop).LineStyle
                    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                oRng.Borders.get_Item(Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeLeft).LineStyle
                    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                oRng.Borders.get_Item(Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeRight).LineStyle
                    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                oRng.Borders.get_Item(Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom).LineStyle
                    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                oRng.EntireColumn.AutoFit();
                oWB.SaveCopyAs(path);
                oWB.Close(false, null, null);
                oXL.Quit();
                //PublicMethod.Kill(oXL);//调用kill当前excel进程
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oWB);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet);
                oWB = null;
                oXL = null;
                oSheet = null;            GC.Collect();
                log.Info("************** 2 ****************");
                System.IO.FileInfo file = new System.IO.FileInfo(path);
                Response.Clear();
                Response.Charset = "GB2312";
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                log.Info("*****************");
                //// 添加头信息,为"文件下载/另存为"对话框指定默认文件名 
                Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name));
                //// 添加头信息,指定文件大小,让浏览器能够显示下载进度 
                Response.AddHeader("Content-Length", file.Length.ToString());            //// 指定返回的是一个不能被客户端读取的流,必须被下载 
                Response.ContentType = "application/ms-excel";            //// 把文件流发送到客户端 
                Response.WriteFile(path);
                //// 停止页面的执行 
                log.Info("************** 3 ****************");
                Response.End();
                log.Info("************** 4 ****************");
            }        catch (Exception theException)
            {
                string error = theException.Message.ToString();
                this.result.Text = error;
                log.Info("**********error=" + error);
            }当程序运行到oWB = (Microsoft.Office.Interop.Excel.Workbook)(oXL.Workbooks.Add(true));
    的时候,就报错了。错误信息就是:
    Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. 
    • To make more memory available, close workbooks or programs you no longer need. 
    • To free disk space, delete files you no longer need from the disk you are saving to. 
    哪位高手给点指点!!!
    急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!