activex (word) in java

Hi, I'm not sure if this is the right topic area, but here goes.... (this question was origonally in the VB section)

I have a Word 8.0 activex component & using a toolkit I've created some java wrapper classes for it.

I'd like to use these to load up a word document inside a java app by using activex calls through these

wrapper classes.

Does anyone know how I can load a word doc using acivex.  I can load the word application, but havn't seen how to load a doc yet.....

any help or pointers would be brilliant (even if it's just directing me to a better topic area to ask the question in)

Thanks for any help,


Question History
From: CJ_S  Date: 07/19/2001 02:54AM PST  

Set wordApp = GetObject("Word.Application")
wordApp.Documents.Open "thedoc.doc"
From: VincentLawlor  Date: 07/19/2001 03:25AM PST  
The syntax is

Dim objDoc as Object
Set objDoc = CreateObject("Word.Document")
objDoc.Documents.Open "Name of file.doc"

I tried this from a VB project it didn't work.

From: TimB  Date: 07/19/2001 04:20AM PST  

Thanks for your replies,

I've tried: app = new;

to get the application.  

The member 'Documents' does not appear to be in this class though...

Alternatively, if I come in from the document side by: thisDoc  = new;

thisDoc can't see the Documents class or member.

I guess I'm probably doing something wrong, and either instanciating something in the wrong order -
or have my class hirachy mixed up somewhere...?

Which containrt can I use to add to a java JPanel?  every time I instantiate a word object, it seems
to load up an instance of office.  Is it 'TextFrame' or would you reccomend using a different class.

Sorry if my response is a bit jumbled.... I'm pretty sure I can make the same AX calls as VB though..
I just don't really use VB though,


From: CJ_S  Date: 07/19/2001 04:22AM PST  
Maybe you should post a link to this question in the java topic area.


From: TimB  Date: 07/20/2001 01:44AM PST  
Here's the code I've used:

public getDoc() {
 // theDoc is a pre-defined member variable
 if (theDoc == null) {
   try {
     System.out.println("inside getBrowser!!!");

     Application app;
     app = getWordApp();
     Documents myDocs = new Documents(app);

     // get a reference to the document we want to open v;
     v = new"E:\\Docs\\chord_analysis.doc"); vrp;
     vrp = new;

     theDoc = myDocs.Open(vrp);
//      theDoc = new;;
   catch(Exception e) {
 return theDoc;

I get a null pointer exception on the line :
  theDoc = myDocs.Open(vrp);
(theDoc does not get created)

can you tell me what I'm doining wrong?  This isn't exactly following your route - I think VB must mask,
of do some of the initialisation for you....

Thanks for ant help,

Who is Participating?
NetminderConnect With a Mentor Commented:
Points refunded and question closed by
CS Moderator
TimBAuthor Commented:
Has anyone loaded an activex component inside a java app before....?
TimBAuthor Commented:
Anyone there...?

Has anyone loaded a word doc inside a java frame?

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

TimBAuthor Commented:
did u find out how to open a word doc inside a java frame? i am also having the same problem. I am using ibm's bridge2java for manipulating doc files.
if u have found something please give me the link or the resource where i might be able to get some leads.

thankx in advance,
TimBAuthor Commented:
I got a set of ActiveX component wrappers created by Gensym in the end.  It's a while ago that I did it now... As far as I remember, it was really easy to create brand new .doc's in the java app, but it was a bit more tricky to load up already existing doc's...

I think the url's - I was just passed a downloaded set of .jar's by a client, so I don't know if there's any registration and/or payment needed..


Question(s) below appears to have been abandoned. Your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, in the event new items have been created since this listing was pulled.

To view your open questions, please click the following link(s) and keep them all current with updates.

------------>  EXPERTS:  Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
Thank you everyone.
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.