• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Loading a word file

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I want to load a .doc file when i click on an option in a menubar I've created. Doesn't have to be loaded into an output window I create or anything; just simply load the .doc file up in, say, Word.
Is there any way I can do that? Sounds like a simple one-line bit of code to go in the function, but probably not
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure
Runtime.getRuntime().exec("winword.exe myfile.doc");
Should work.
 
Lloyd Jenkins
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cindy, you are a Goddess
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gee - a promotion!!
 
Lloyd Jenkins
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
haha! You deserve it. You've given me the only positive out of my imminently-deadlined assignment
 
Lloyd Jenkins
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used the...
Runtime.getRuntime().exec("winword.exe myfile.doc");
...line that Cindy gave me. I use it inside an 'else if' statement, but it asks for an IOException to be caught.
I've created this exception inside the 'else if' statement (with the line call), but it wants a try call too...which I can't do.
Here's the offending bit of code. Thank you people
--------
public void serviceMenuEvent(MenuItem menuItemObject)
{
..... (previous code)
else if (menuItemObject == vrep)
{
Runtime.getRuntime().exec("winword.exe report.doc");
catch (IOException e)
{
System.err.println(e);
}
}
}
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

That will work.
[ April 18, 2002: Message edited by: Gregg Bolinger ]
 
Lloyd Jenkins
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You guys rule
Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic