I have a Java application that opens WebDAV files on MS Word. This works successfully on Windows with the next code:
Runtime.getRuntime().exec("cmd /c start winword " + webdavUrl);
But on Mac OSX this is not possible. I tried this function, but it only opens a blank document:
Runtime.getRuntime().exec(new String[]{"open", "-a", "Microsoft Word", webdavUrl});
if I create a file from the URL, I can open the file but I lose its reference to the WebDav URL.
I have found a discussion about a javascript code that can do this process from the browser.
Any thoughts?
With the WebDav SSL integration within Workspace 365 you bring all your documents together in the Workspace 365 Documents App. From the workspace you can easily open files with the locally installed Office applications and with the Office Online Server (OOS).
Tip: You can open files created with Microsoft Office on your Mac. Use the Pages app to open Microsoft Word documents, the Numbers app to open Microsoft Excel spreadsheets and the Keynote app to open Microsoft PowerPoint presentations.
First, can you access the directory where the word doc is? are you mounting your webdav?
I believe the terminal will be looking for a path, which is your webdavUrl. To debug, try running the same command but only with the -R and webdavUrl arguments.
Runtime.getRuntime().exec(new String[]{"open", "-R", webdavUrl});
-R will show the file in finder and this way you know that terminal can in fact navigate to your webdavUrl.
You may try one of the following:
1: Use the Desktop Api as described here.
File myFile = new File(webdavUrl); Desktop.getDesktop().open(myFile);
2: Use ms-word:
uri as detailed here.
For example enter "ms-word:ofe|u|http://webdavUrl"
on your browser. If you have Microsoft Office (2010 SP2+) installed this should open the word application with your document loaded.
The following resources might be helpful as they cover different ways you could open/edit word files in a webdav server.
How to open file in Microsoft Word on Mac OS X from within Java?
http://www.webdavsystem.com/ajax/programming/opening_ms_office_docs/
Is there an Application URL Protocol for MS Word?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With