http://www.javajia.com/article.php?id=846
解决方案 »
- 一个小问题!!!!!!非常小!!!!!!!
- 老师布置的几道题!求最简单的代码
- 用Graphics2D 做 emf图片 我做了两天没做出来,高手赐教
- 子查询的问题select id,(select top 1 username from stu b where a.id=b.id) as usera from stu a group by id如何取得其中子查询的值呢
- JAVA调用WORD书签
- 内存溢出问题
- 多个文件循环上传时出错
- 我有一个很好的java开发工具,绝对比visualage,forte,visualcafe,jb好用,速度还快,谁想要?
- 一个think in java的翻译问题
- 我编了一个检测ip地址的程序,可是遇到代理服务器就不灵了,请问如何在程序中加以改变??
- ****请教struts 国际化问题,100分。请大家帮忙****
- 如何去除字符串中的某个字符(可能有多个)
----------------import com.jacob.com.*;
import com.jacob.activeX.*;public class openword
{ public static void open(String paths)
{
System.out.println("In open......");
ActiveXComponent app = new ActiveXComponent("Word.Application");//启动word
String inFile = paths;//word file to open
try
{
app.setProperty("Visible", new Variant(true));//设置word可见
Object docs = app.getProperty("Documents").toDispatch();
Object doc = Dispatch.invoke(docs,"Open", Dispatch.Method,
new Object[]{inFile,new Variant(false), new Variant(true)},
new int[1]).toDispatch();//打开word文件
}
catch (Exception e)
{
e.printStackTrace();
}
System.out.println("over!...");
}
public static void main(String[] args)
{
String paths = new String("D:\\test\\word\\test.doc");
open(paths); }
}