http://www.javajia.com/article.php?id=846

解决方案 »

  1.   

    poi才是正道····
    ----------------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); }
    }