存放地点变更修复
This commit is contained in:
@@ -3,7 +3,6 @@ package com.yxt.common.base.utils;
|
|||||||
import com.jacob.activeX.ActiveXComponent;
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
import com.jacob.com.ComThread;
|
import com.jacob.com.ComThread;
|
||||||
import com.jacob.com.Dispatch;
|
import com.jacob.com.Dispatch;
|
||||||
import com.jacob.com.Variant;
|
|
||||||
import freemarker.template.Configuration;
|
import freemarker.template.Configuration;
|
||||||
import freemarker.template.Template;
|
import freemarker.template.Template;
|
||||||
import freemarker.template.Version;
|
import freemarker.template.Version;
|
||||||
@@ -91,6 +90,7 @@ public class WordUtils {
|
|||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Dispatch document = null;
|
Dispatch document = null;
|
||||||
try {
|
try {
|
||||||
|
ComThread.InitSTA();
|
||||||
// 打开word
|
// 打开word
|
||||||
app = new ActiveXComponent("Word.Application");
|
app = new ActiveXComponent("Word.Application");
|
||||||
// 获得word中所有打开的文档
|
// 获得word中所有打开的文档
|
||||||
@@ -116,13 +116,14 @@ public class WordUtils {
|
|||||||
// 关闭文档
|
// 关闭文档
|
||||||
Dispatch.call(document, "Close", false);
|
Dispatch.call(document, "Close", false);
|
||||||
// 关闭office
|
// 关闭office
|
||||||
// app.invoke("Quit", 0);
|
app.invoke("Quit", 0);
|
||||||
System.out.println("关闭文档");
|
System.out.println("关闭文档");
|
||||||
if (app != null)
|
// if (app != null)
|
||||||
app.invoke("Quit", new Variant[]{});
|
// app.invoke("Quit", new Variant[]{});
|
||||||
|
// 如果没有这句话,winword.exe进程将不会关闭
|
||||||
|
ComThread.Release();
|
||||||
}
|
}
|
||||||
// 如果没有这句话,winword.exe进程将不会关闭
|
|
||||||
ComThread.Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user