EXCEL进程问题的新发现,不知道对不对 GC.Collect()我试了这个,也没有用啊:( 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try { sheet = null; sheets = null; this.oBook .Close (System.Reflection .Missing .Value ,System.Reflection .Missing .Value,System.Reflection .Missing .Value); this.oBook = null; oExcel.Quit(); oExcel = null; GC.Collect (); } catch { oExcel.Quit(); oExcel = null; GC.Collect (); }肯定行,我试过了! 你最好再你调用这个函数的控件的CLICK事件中调用GC.Collect();例如:Button_Click(...){...GC.Collect();} 我是自己写一个类来处理Excel的,在类处理完了Excel后再把类=null,才调用GC.Collect()的,成功把Excel进程关了。 oExcel.Quit();System.Runtime.InteropServices.Marshal.ReleaseComObject(tempRange);System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);System.Runtime.InteropServices.Marshal.ReleaseComObject(sheets);System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook);System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel);oMissing=null;sheets=null;tempRange=null;worksheet=null;oBook=null;oExcel=null;GC.Collect();??我也是看到别人的,不过我没有出现你说的问题 我的程序在生成文件后也不能关闭,后来查询资料,据说是Win2000和excel2000版本不够,升级后依然不能关闭。但是后来我发现只要不调用保存就没有问题,因此我现在都是使用Saveas来存盘,然后关闭就没有问题了,你可以试试。 后台获取前台html控件 验证码不区分大小写 按退出按钮时,必填验证显示必须要填,怎么处理? 新手问几个有关定时器的初级问题!!! <%# 刚才问一查询问题,现在再问个SQL查询问题 查找表中某个字段不同的记录---------救命 啊,,,,急,没分了大家帮帮忙 .net学习群4468533 大家一起进步 欢迎有工作的人来 ASP中嵌入播放器的问题 如果让我的Asp.net应用程序只能用IE浏览器打开 请教系统login时候,用户和角色的定义是如何用一个实现User:IPrincipal的对象实现的? 请教高手帮忙 急:求asp.net(C#)播放rm文件的源代码 文件下载时遇到的问题
{
sheet = null;
sheets = null;
this.oBook .Close (System.Reflection .Missing .Value ,System.Reflection .Missing .Value,System.Reflection .Missing .Value);
this.oBook = null;
oExcel.Quit();
oExcel = null;
GC.Collect ();
}
catch
{
oExcel.Quit();
oExcel = null;
GC.Collect ();
}
肯定行,我试过了!
例如:
Button_Click(...){
...
GC.Collect();
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(tempRange);
System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(sheets);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel);oMissing=null;
sheets=null;
tempRange=null;
worksheet=null;
oBook=null;
oExcel=null;
GC.Collect();
??我也是看到别人的,不过我没有出现你说的问题