Excel.Application oExcel;
Excel.Workbook oBook;
Object oMissing = System.Reflection.Missing.Value;
oExcel = new Excel.Application();
oBook = oExcel.Workbooks.Add(oMissing);
for (int i=1;i<=4;i++)
{
oExcel.Cells[i,1]=i.ToString();
oExcel.Cells[i,2]="'bbb2";
oExcel.Cells[i,3]="'ccc3";
oExcel.Cells[i,4]="'aaa4";
}
oBook.Saved = true;
oExcel.UserControl = false;
string mm=Server.MapPath(".")+"\\aa.xls";//服务器保存地址
oExcel.ActiveWorkbook.SaveCopyAs (mm);
oExcel.Quit();
Response.Redirect ("aa.xls");//
Excel.Workbook oBook;
Object oMissing = System.Reflection.Missing.Value;
oExcel = new Excel.Application();
oBook = oExcel.Workbooks.Add(oMissing);
for (int i=1;i<=4;i++)
{
oExcel.Cells[i,1]=i.ToString();
oExcel.Cells[i,2]="'bbb2";
oExcel.Cells[i,3]="'ccc3";
oExcel.Cells[i,4]="'aaa4";
}
oBook.Saved = true;
oExcel.UserControl = false;
string mm=Server.MapPath(".")+"\\aa.xls";//服务器保存地址
oExcel.ActiveWorkbook.SaveCopyAs (mm);
oExcel.Quit();
Response.Redirect ("aa.xls");//
解决方案 »
- 求性能测试软件
- 求一正则表达式
- 如何实现按快捷键自动下拉ComboBox控件内容?
- 奇怪问题:VS2008ENG版按F5运行程序后关闭程序回到开发环境会停顿3~25秒!!!
- 日语カナ小写变大写
- 找不到Microsoft.Interop.Security.AzRoles在Win2000 Server!!!
- 请问如何打开后缀为nrg的文件?
- 昨天给老婆定了3支玫瑰,结果花店把卡片搞错了,老婆心情大坏.......
- 寻求7cd中文vs.net正式版下载地址。
- .Net 4.0 下 虚拟化树节点展开问题
- 请教Console.ReadLine与Console.Read的区别
- GridView_Updating事件里更新不了新值...
Server Error in '/Web' Application.
--------------------------------------------------------------------------------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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: 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.Source Error:
Line 234: catch (Exception ex)
Line 235: {
Line 236: throw ex;
Line 237: }
Line 238: }
Source File: d:\Work\DotNet\Web\Default.aspx.cs Line: 236 Stack Trace:
[COMException (0x800a03ec): 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.]
_Default.Button2_Click(Object sender, EventArgs e) in d:\Work\DotNet\Web\Default.aspx.cs:236
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42