操作EXCEL过后会发现遗留 EXCEL的进程,读取完毕或者抛异常后直接把进程关掉
/// <summary>
/// 关闭EXCEL进行
/// </summary>
public void CloseProcess()
{
System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process myProcess in myProcesses)
{
if ("EXCEL" == myProcess.ProcessName)
myProcess.Kill();
}
}