wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes Problems with Jacob Dispatch Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Problems with Jacob Dispatch Class" Watch "Problems with Jacob Dispatch Class" New topic
Author

Problems with Jacob Dispatch Class

Steve Stanicki
Greenhorn

Joined: Sep 24, 2005
Posts: 23
Hello All,
I am working on a project that will open Word Mail mail merge docs, and I need to open a specific file. I have a UI that let's the user choose a document with a button, and the action passes the path and file name to my class that I have written using Jacob.

I have import statements for com.jacob.activeX.ActiveXComponent;, and import com.jacob.com.*;

The problem is I have an example from www.land-of-kain.de/jacob/ for doing this with the following lines:

ActiveXComponent oWord = new ActiveXComponent("Word.Application");
oWord.setProperty("Visible", new Variant(true));
Object oDocuments = oWord.getProperty("Documents").toDispatch();
Object oDocument = Dispatch.call(oDocuments, "Open", myFileName);

The basic problem is, that I have an app working that opens MS Word, and inserts a line of text. (I used my file path/name to make sure it was getting there). But when I try to use the Dispatch class the compiler says it can't find the "class" call in Dispatch. I have also tried import statements like com.jacob.Dispatch.*; and com.jacob.Dispatch;

I have peeked inside the jacob jar file with winzip, and I can see the call method, and the nodes.

How do you get Jacob to point to a specific file? I am able to open Word with my app, and insert text, but I want to point to a specific file.

Any input would be appreciated.

Thanks,
Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with Jacob Dispatch Class