Asp.net 操作Excel 无法关闭解决方法之一
来源:互联网 发布:淘宝营销代理 编辑:程序博客网 时间:2024/06/06 00:57
if (range != null)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(range);
range = null;
}
catch (Exception e1)
{
}
}
if (worksheet != null)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);
worksheet = null;
}
catch (Exception e2)
{
}
}
if (workbook != null)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);
workbook = null;
}
catch (Exception e3)
{
}
}
if (workbooks != null)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbooks);
workbook = null;
}
catch (Exception e3)
{
}
}
try
{
KillExcelProcess(xlApp.Hwnd);
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
if (xlApp != null)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
xlApp = null;
}
catch (Exception e4)
{
}
}
GC.Collect();
这种方式经常关闭不了Excel,苦熬几个小时,测试无数,最后将站点中的bin目录中的excel.dll的security添加了everyone完全控制搞定了,我#¥#)(×)¥(#。
- Asp.net 操作Excel 无法关闭解决方法之一
- 【转】.NET引用Excel操作时无法关闭Excel.exe进程的解决方法
- asp.net 操作EXCEL
- asp.net 操作Excel
- asp.net操作excel
- asp.net 操作excel
- Asp.net操作Excel
- 在asp.net中操作excel如何关闭excel的进程
- asp.net导出excel方式之一
- asp.net操作Excel总结
- asp.net操作Excel总结 - -
- asp.net操作Excel总结
- asp.net操作Excel总结
- 用ASP.NET操作Excel
- asp.net操作excel 代码
- ASP.NET操作Excel实例
- ASP.NET操作Excel实例
- 用ASP.NET操作Excel
- 用C#制作飘动的窗体效果
- 稀疏矩阵的接压缩算法的实现
- Ext中的TextArea存值和显示值的问题
- VS2008Express下配置WTL开发环境
- linux下编译c++的一个小问题(解决)
- Asp.net 操作Excel 无法关闭解决方法之一
- Tomcat配置MySql数据源
- C++网络编程 ACE相关资料收集
- Tomcat中配置数据源
- Tomcat数据源配置!
- 网址收藏
- 装箱和拆箱
- 安装VS2005补丁出现错误1718的解决方法
- 用VC++建立Service服务应用程序