jacob操作word的问题 我想用java 打开word编辑器,用jacob实现了,但是不知道怎么检测打开的word什么时候关闭,比如说SQL里面有个word文档,我将它读出来用word打开了,没出现问题,但是当我把已打开的文档编辑好后,点word的红色关闭按钮关闭了,我想在这个时候再将编辑好的文档上传到sql里面,请问我该检测那个关闭事件。, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 呵呵,自己搞定了public class invokecom{ public static void main(String[] args) {ActiveXComponent app = new ActiveXComponent("Word.Application"); String inFile = "I:\\edocument\\test.doc"; boolean flag = false;try {app.setProperty("Visible", new Variant(true)); Dispatch docs = app.getProperty("Documents").toDispatch();Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method,new Object[] {inFile, new Variant(false), new Variant(false)},new int[1]).toDispatch(); Dispatch content = Dispatch.get(doc, "Content").toDispatch(); System.out.print(content.toString());while(true){if( app.connectToActiveInstance(app.getProgramId()) == null){ System.out.print("文档编辑已完成,准备上传中..."); System.exit(0);}}}catch (Exception e) {e.printStackTrace();}}} ArrayList动态输入对象问题 jprofiler web start上傳文件問題 比较两个数组 移动窗口的那个虚线框怎么画?? 引用数据类型的存储机制! jsp:include中的flush是什么意思? 请各位高手告诉我什么时候调用的tostring 没办法,还要问tomcat的问题,是不是和机器有关,总之没搞定!You are Welcome! 创建包和引用包碰到的问题,请各位指点,谢谢。 程序员联盟 群号:3546259 欢迎it界从事计算机程序的加盟 一个小问题(关于.tld)
public class invokecom
{
public static void main(String[] args) {ActiveXComponent app = new ActiveXComponent("Word.Application");
String inFile = "I:\\edocument\\test.doc"; boolean flag = false;
try {
app.setProperty("Visible", new Variant(true));
Dispatch docs = app.getProperty("Documents").toDispatch();
Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method,
new Object[] {inFile, new Variant(false), new Variant(false)},
new int[1]).toDispatch();
Dispatch content = Dispatch.get(doc, "Content").toDispatch();
System.out.print(content.toString());
while(true){
if( app.connectToActiveInstance(app.getProgramId()) == null){
System.out.print("文档编辑已完成,准备上传中...");
System.exit(0);
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}