Solved

Open MS Word with a Java applet.

Posted on 2003-10-30
5
819 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

696 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