Office WebDav and Javascript

So…. long story short it is possible to reuse office within the browser by using the Word ActiveX control as well as most other Office products like Excel and Powerpoint. The problem then becomes editing the information. There is a registry tweak that enables this with the default ActiveX control, however, the sharepoint dll which provides a nicer interface out of the box allows what you need to do without changes to the registry and also ships with office since 2007 according to outside sources.

To set up WebDav on IIS requires a few things:

Windows Authentication enabled
Web Dav Enabled
Web Dav Configured
Directory Browsing Enabled ( not 100%, just a nicety from the web )
A virtual path for the folder ( also not 100% necessary )

Once this is done, you can set up a network connection using the http path to the webdav folder by mapping a drive. This will help test that the connection authentication is good.
SharePoint method ( works as long as the SharePoint parts are installed with office )

   try {
       var obj = new ActiveXObject('SharePoint.OpenDocuments.3');
        obj.EditDocument("http://localhost/doc/Document.docx");
    } catch (e) {
        alert(e);
    }

The final hurdle is setting up the security permissions in Internet Explorer. I would suggest using a trusted site specific for the domain you want to try this on, then enable prompting of unsafe activex controls ( Word ActiveX specifically )

Standard Microsoft Office method ( works as long as the Microsoft Office is installed )

   try {
        var oApplication = new ActiveXObject("Word.Application");
        oApplication.Visible = true; // "Visible" is in the Word Object Model
        oApplication.Documents.Open("http://localhost/doc/Document.docx");
    } catch (e) {
        alert(e);
    }
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *