java 操作 word文档的问题
我下了一些代码,是java操作word的内容,调试的时候总出错. 除了下面的问题,还想问,jacbo1.7是不是必须配合jdk1.3使用,我的jdk是1.4
ActiveXComponent component = new ActiveXComponent("Word.Application");
String inFile = "c:\\t.doc";
String tpFile = "c:\\t.htm";
String otFile = "d:\\t.xml";
boolean flag = false;
try {
component.setProperty("Visible", new Variant(false));
Dispatch wordacc = component.getProperty("document. ").toDispatch();
//请问上面这句是什么意思呀!
Dispatch wordfile = Dispatch.invoke(wordacc,"Open", Dispatch.Method,
new Object[]{inFile,new Variant(false), new Variant(true)},
new int[1] ).toDispatch();
//这句又是什么意思
Dispatch.invoke(wordfile,"SaveAs", Dispatch.Method, new Object[]{tpFile,new Variant(8)}, new int[1]);
Variant f = new Variant(false);
Dispatch.call(wordfile, "Close", f);
flag = true;
} catch (Exception e) {
e.printStackTrace();
} finally {
component.invoke("Quit", new Variant[] {});
}