Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open WebDAV word file on OSX

Tags:

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?

like image 604
Tito Leiva Avatar asked Dec 07 '15 21:12

Tito Leiva


People also ask

Does Office 365 support WebDav?

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).

Can a Mac open a Word file?

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.


2 Answers

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.

like image 126
Ahmed Musallam Avatar answered Dec 01 '22 07:12

Ahmed Musallam


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?

like image 40
Yohannes Avatar answered Dec 01 '22 06:12

Yohannes