public boolean replaceText(String toFindText, String newText) {
moveStart(); //加入光标每次为开始的记录,每次都从word文档开始搜索,以免find不到
if (!find(toFindText))
return false;
Dispatch.put(selection, "Text", newText);
return true;
}
/** *//**
* 把插入点移动到文件首位置
*
*/
public void moveStart() {
if (selection == null)
selection = Dispatch.get(word, "Selection").toDispatch();
Dispatch.call(selection, "HomeKey", new Variant(6));
}