--解决wod无法关闭数据无法保持导致删除水印失败

master
程志刚 11 months ago
parent d734a4fb6e
commit 38a24d6e54

@ -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)
{

Loading…
Cancel
Save