当前位置: > public static void main(String[] args) {...
题目
public static void main(String[] args) {
// 启动Word,生成一个ActivexComponent对象
ActiveXComponent app = new ActiveXComponent("Word.Application");
Map mapBookMark = new HashMap();
mapBookMark.put("name","123");
// 要转换的word文件
String inFile = "d:\1.doc";
// 要报存的目标文件
String tpFile = "d:\2.doc";
try {
app.setProperty("Visible",new Variant(true));
// 打开word文件
Dispatch docs = (Dispatch) Dispatch.get(app,"Documents")
.toDispatch();
Dispatch doc = Dispatch.invoke(
docs,
"Open",
Dispatch.Method,
new Object[] { inFile,new Variant(false),
new Variant(true) },new int[1]).toDispatch();
Dispatch activeDocument = app.getProperty("ActiveDocument")
.toDispatch();
Dispatch bookMarks = app.call(activeDocument,"Bookmarks")
.toDispatch();
// 标签替换
Iterator it = mapBookMark.keySet().iterator();
while (it.hasNext()) {
String bookMarkKey = (String) it.next();
String bookMarkNewValue = (String) mapBookMark.ge

提问时间:2021-03-04

答案
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.