Solved

Open MS Word with a Java applet.

Posted on 2003-10-30
5
807 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
simple java question 3 59
HTTPSessionBindingListernter not configured in deployment descriptor 2 65
map related example 6 55
Error in @AspectJ Based AOP with Spring 2 18
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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 different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

837 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