Solved

Open MS Word with a Java applet.

Posted on 2003-10-30
5
791 Views
Last Modified: 2012-06-27
How can I start MS-Word from a Java Application Applet? I'm looking for a example.

More specifically, I would like to pass a word macro parameters if it is possible.

We are using mozilla browser and we need to open ms word from an intranet application.

Thanks in Advance.
John
0
Comment
Question by:jtrapat1
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9651621
Can you explain what you mean by "Java Application Applet"? Of course an application and an applet are two distinct things normally.
0
 

Author Comment

by:jtrapat1
ID: 9651666
sorry,

I meant java application OR java applet.

john
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 125 total points
ID: 9651731
An applet will have to be signed and an application is not applicable in a browser context. Theoretically, if your Mozilla has a Word plugin, you should be able to set the mime type and have the browser open the Word stuff in-place without using applets.
0
 

Author Comment

by:jtrapat1
ID: 9653276
thanks for the help.
I'm using mozilla 1.5 -
where can i download this word plug-in that you mentioned?

thanks
john
0
 
LVL 2

Expert Comment

by:prcsn1
ID: 9653974
If you need to drive MS Word - a macros or similar, you will have to fire it off through ActiveX. This can be done (though not from an applet, I imagine - the secirty would stop you unless you turned it off).
If you do want to do this it is farly easy to do using Jawin. Some code:

public void init() {
    try {
      Ole32.CoInitialize();
      logger.info("CoInitialise complete");

      app = new DispatchPtr("Word.Application");
      logger.info("opened app");

      app.put("Visible", true);
      logger.info("set visible");
    }
    catch (Exception ex) {
      logger.log(Level.WARNING, "exception during co itialise (ie setting up Word) ", ex);
    }
  }


.... and later, to fire off the macro "mailMergeLoad" with some params

Object o = app.invoke("Run", "mailMergeLoad", templateDir + "\\" + templateFilename);

........... This will work from a Java application, but an applet will have troubles. If all you need is to see MS Word documents, other ways will be easier.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now