From 38a24d6e543a82d7cdb365bfb54a0e4d930b886e Mon Sep 17 00:00:00 2001 From: cheng19920620 <511180749@qq.com> Date: Mon, 18 Dec 2023 15:42:35 +0800 Subject: [PATCH] =?UTF-8?q?--=E8=A7=A3=E5=86=B3wod=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=95=B0=E6=8D=AE=E6=97=A0=E6=B3=95=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E5=AF=BC=E8=87=B4=E5=88=A0=E9=99=A4=E6=B0=B4=E5=8D=B0?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CCFlow/Components/BP.En30/Pub/Engine.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CCFlow/Components/BP.En30/Pub/Engine.cs b/CCFlow/Components/BP.En30/Pub/Engine.cs index 7408c61d..fe3a6018 100644 --- a/CCFlow/Components/BP.En30/Pub/Engine.cs +++ b/CCFlow/Components/BP.En30/Pub/Engine.cs @@ -17,6 +17,7 @@ using System.Linq; using System.Collections.Generic; using Spire.Doc.Documents; using NPOI.SS.Formula.Functions; +using System.Diagnostics; namespace BP.Pub @@ -1331,6 +1332,16 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br docs.Paragraphs[1].Range.Delete(); docs.SaveAs2(path); docs.Close(); + Process[] current = Process.GetProcesses(); + //遍历与当前进程名称相同的进程列表 + foreach (Process process in current) + { + //如果实例已经存在则kill当前进程 + if (process.ProcessName.ToUpper().Equals("WINWORD")) + { + process.Kill(); break; + } + } } catch (Exception ex) { @@ -1735,6 +1746,16 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br docs.Paragraphs[1].Range.Delete(); docs.SaveAs2(path); docs.Close(); + Process[] current = Process.GetProcesses(); + //遍历与当前进程名称相同的进程列表 + foreach (Process process in current) + { + //如果实例已经存在则kill当前进程 + if (process.ProcessName.ToUpper().Equals("WINWORD")) + { + process.Kill(); break; + } + } } catch (Exception ex) {