The class that you need to look at is the java.awt.Desktop class. It was added
to the API in version 1.6 and, to quite Sun;
The Desktop class allows a Java application to launch associated applications
registered on the native desktop to handle a URI or a file.
Supported operations include:
launching the user-default browser to show a specified URI;
launching the user-default mail client with an optional mailto URI;
launching a registered application to open, edit or print a specified
file.
It is possible to test both to see whether the class is supported and, more
importantly in my opinion, if the operation you wish to perform is supported.
Of course, it means that you will have to ensure Word is installed on every
machine and that they have the most recent version of the Java runtime
available.
Anthony Andrews <[EMAIL PROTECTED]> wrote: I am no expert but I do not think
that it is possible to print a Word document using POI. As far as I am aware,
the API offers the ability to create or modify documents not print them; of
course, I could be wrong.
Your best bet would be to use Java in my opinion. Off of the top of my head, I
cannot remember the name of the class but there is one in the API itself that
will use the registered application to handle - and that includes printing as
far as I am aware - a particular type of file. As Word is likely to be the
registered application for handling a .doc file then it should be easy to
create a class of your own to accomplish this task. If I have the time, I will
see if I can find an example I saw in a book and post that, if not, I will look
up the name of that Sun class.
Moley Harey wrote: Hi,
I am developing a Java Struts application that prints a copy of a given MS
Word file stored locally.
I have read POI is the best choice to do this but I have downloaded the
binary POI 3.0.1and cannot find clear examples for printing Word documents
using HWPF API...
Does anybody tried the same?
Any suggestion?
Thanks in advance!
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
---------------------------------
Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get online.