PDA

View Full Version : Opening powerpoint files using Java




compbry15
Oct 23, 2009, 10:10 AM
Hello,

I am working on a signed Java applet (used on an internal network only, so has full system privileges as if it were an application). As of now the applet works perfectly on Windows, but we are wanting to expand to let our growing base of Mac users to use the software too.

One of the main functions of the applet is that it launches files (mostly powerpoint files). These files are stored on the server and their names are displayed in the browser as a select list.

The user selects a file from the select list and can hit Preview, Edit, or Delete. At this point the file is downloaded from the server to the user's Desktop and subsequently opened by the operating system.

Delete is fairly simple, it deletes the file from the server and does not download the file.

On Windows, Preview opens the file in SlideShow mode regardless of if the file extension is ppt or pps. i.e. what you see when using PowerPoint Viewer, it goes directly to running the slideshow and no option to edit.

Also on Windows, Edit opens a ppt or pps file in the normal PowerPoint editor, so that you can make changes to the presentation and save/exit.

I am aware of the Desktop API for Java but this doesn't seem to work in this case. Both Desktop.open and Desktop.edit opens a file in the normal PowerPoint perspective. Instead, I have opted to use Runtime.getRuntime().exec() and pass it the full path to POWERPNT.exe. For the Preview action I also pass the "/s" switch, which forces it to run in slideshow mode. As stated earlier, this is working wonderfully for Windows.


Now that you see the picture of what I am trying to accomplish, onto the problem. As I said earlier we are wanting to branch into Mac OSX. I have determined that I can accomplish much the same thing on OSX again using the Runtime.getRuntime().exec() function, but this time pass it off to the 'open' command.

i.e.

Runtime.getRuntime().exec("open -b com.microsoft.Powerpoint file.ppt");

This forces it to use the com.microsoft.Powerpoint application bundle and is working very well for generically opening a ppt file. However, I am unable to specify any command switch, like I can on Windows, to force the file to be opened as a slideshow instead of in edit mode.


Does anyone know how to specify a command line switch, or some other suggestion or solution to opening a ppt/pps file specifically as a slideshow or in edit mode?

Note: Renaming the file between ppt and pps to trigger slideshow mode is not an option here, unfortunately, for various "upper management" reasons.

Thanks so much for any help you can provide!