none
Open / Edit / Save a word on a web server RRS feed

  • Question

  • I was given the following requirement, I am wondering if this is possible:

    1. I have docx(2007) files stored on a server.

    2. I need to allow the users to open those files LOCALLY with their instances of Microsoft Word 2007. 

    3. the users will be able to edit the file and when they press 'Save', the file will save REMOTELY BACK TO THE SERVER.

    4. the docx files could be stored on Unix machines, so any Window specific solutions will not work unfortunately.

    I was under the impression that I can use VSTO to write a add-in for Word which could let me save to the server. Could anyone please verify that? (although I read in this post that I can't :( http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/368db5a8-1cf5-4108-89da-0d3540d77987/)

     

    Thanks for any help

    Monday, November 22, 2010 10:25 PM

Answers

  • Hi Chao Qu

    Mmm. The only thing that occurs to me would be to work with the OpenXML file format, which will avoid needing to use the object model (SaveAs) back to the server location.

    The add-in (VSTO or otherwise) installed on the user's machine can use the Document.Content.WordOpenXML property to get the entire document content in a string. This can be "streamed" back to the server and then saved as a .docx file.

    When you do this, the *.docx file will be in the Office OpenXML "flat package" file format. For more information about Office Open XML see OpenXMLDeveloper.org and the Open XML SDK forum on MSDN.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Chao Qu Wednesday, November 24, 2010 9:18 PM
    Tuesday, November 23, 2010 8:30 AM
    Moderator
  • Hi Chao Qu

    1. No. docx is the OpenXML file format

    2. I don't know; try it and find out

    3. Yes

    4. Your options depend on the programming language you prefer to work with. All Office Add-ins base on the IDTExtensibility2 interface, which most programming languages can implement. In the current "Microsoft world" this would be either the Visual Studio "Shared Add-in" template, which works directly with that interface or a "Visual Studio Tools for Office" add-in that implements the interface for you, so that you can work directly on your code without worrying about the "plumbing" involved. For what you describe, nothing speaks against using a VSTO add-in if you're comfortable with VB.NET or C# and using a .NET Framework solution.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Chao Qu Wednesday, November 24, 2010 9:00 PM
    Wednesday, November 24, 2010 5:36 PM
    Moderator

All replies

  • Hi Chao Qu

    Mmm. The only thing that occurs to me would be to work with the OpenXML file format, which will avoid needing to use the object model (SaveAs) back to the server location.

    The add-in (VSTO or otherwise) installed on the user's machine can use the Document.Content.WordOpenXML property to get the entire document content in a string. This can be "streamed" back to the server and then saved as a .docx file.

    When you do this, the *.docx file will be in the Office OpenXML "flat package" file format. For more information about Office Open XML see OpenXMLDeveloper.org and the Open XML SDK forum on MSDN.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Chao Qu Wednesday, November 24, 2010 9:18 PM
    Tuesday, November 23, 2010 8:30 AM
    Moderator
  • Cindy,

    Thanks for the reply, a few things are still unclear to me in your response.

    1. do I need to modify the *docx files on my server in any way to work with the OpenXML file format?

    2. when the user clicks on a link to the *docx file, is the file saved on his local disk? Maybe in the temp directory?

    3. would the Document.Content.WordOpenXML property capture the changes the user made to the file without the user saving it as a local copy first?

    4. I have never written an add-in for Word before, since you said *VSTO or otherwise* I am wondering what are my options?

    Tuesday, November 23, 2010 2:53 PM
  • Do you mean "files stored in the ordinary Unix file system" ?

    If so, I don't think you will be able to get at them directly from Word.

    A Word user should be able to open files on an http: server (or maybe it has to be a WebDav server to do the saves) or an SMB server, e.g. implemented using Samba, but maybe that's what you are trying to avoid.


    Peter Jamieson
    Tuesday, November 23, 2010 4:33 PM
  • Peter,

    Thanks for the reply. The files are stored on a server, I can access it by an URL.I was just saying the server's OS could be non-windows.

    Tuesday, November 23, 2010 6:36 PM
  • Broadly speaking, I don't think the OS is a factor as long as it supports the necessary protocols. But off the top of my head, if you were using SMB (for example) I couldn't tell you whether Word is dependent on the behaviour of Microsoft's implementation of SMB, e.g. behaviour that the Unix-based versions of SMB have not yet been able to replicate.

    But I'm wondering whether you have tried http: already and discovered that e.g.

     a. it is actually sufficient for your needs

     b. it does what you need on an MS server but not on a Unix one

     b. it doesn't do what you need on either platform.

    As for opening documents via http, it is perhaps worth pointing out that not everything that Word might open can be opened from an http: URL. For example, Word will not open a mail merge data source located at an http URL (unless you fix the URL in the OOXML, and I suspect that only works on Word 2007)


    Peter Jamieson
    Wednesday, November 24, 2010 10:11 AM
  • Peter,

    What do you mean by have I tried http? Are you referring to an URL link to the document on my server? The docx files are stored on a web server and they are available to the users as links on a web page. There isn't a problem opening up the documents as long as the users have Word installed, the problem is saving back to the server when they click save.

    Thanks

     

    Wednesday, November 24, 2010 3:17 PM
  • The docx files are stored on a web server

    OK, now I know where you're coming from. I got the impression you were talking about something more general than "web servers"

    AIUI having a web server is not enough - you will get read only access, as you have discovered. I believe the server has to have WebDav enabled to be able to write the documents back (see, e.g. http://httpd.apache.org/docs/2.0/mod/mod_dav.html if your server is using the Apache web server). 

    But unfortunately I cannot tell you for sure that WebDav is either necessary or sufficient for your needs.


    Peter Jamieson
    Wednesday, November 24, 2010 4:20 PM
  • Hi Chao Qu

    1. No. docx is the OpenXML file format

    2. I don't know; try it and find out

    3. Yes

    4. Your options depend on the programming language you prefer to work with. All Office Add-ins base on the IDTExtensibility2 interface, which most programming languages can implement. In the current "Microsoft world" this would be either the Visual Studio "Shared Add-in" template, which works directly with that interface or a "Visual Studio Tools for Office" add-in that implements the interface for you, so that you can work directly on your code without worrying about the "plumbing" involved. For what you describe, nothing speaks against using a VSTO add-in if you're comfortable with VB.NET or C# and using a .NET Framework solution.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Chao Qu Wednesday, November 24, 2010 9:00 PM
    Wednesday, November 24, 2010 5:36 PM
    Moderator
  • Thanks for the help.
    Wednesday, November 24, 2010 9:03 PM