Open WORD Document from Database OR WebService

点点圈 提交于 2019-12-10 11:42:29

问题


Without getting into a large debate as to the merits of doing so, can some one provide direction as to using a VSTO Application Level AddIn (Word 2007) to oepn a MS Word Document from either a database or a web service?

Thank you


Jacob,

Are you suggesting

  1. PC/AddIn Queries Server for a Document
  2. Server returns document to PC/AddIn
  3. PC/AddIn saves document locally (as temp file)
  4. PC/AddIn uses word Open document functionality to open the file locally

Then

  1. PC/AddIn Save these file locally
  2. PC/AddIn Uploads the file back to the server

That doesn't sound quite so hard... In fact it is the type of solution that has a level of simplicity that makes writing / debugging easy.

What advantage does one have using the above methodology as oppoased to WebDAV? Apparently webDav is what alfresco uses...

Another question though, Does word not have the functionality to open documents from a stream in its API?

T


回答1:


As Jacob noted, you could save the blob as a tmp file, and then open it in the normal way. This is the easiest, though if you need to write the edits back, you'll also need to think about locking.

If you need to worry about those things, WebDAV starts to look more interesting. You could open via WebDAV if you can make your server-side support this, and let Word do the rest (although the document may be read only, depending on client config and server).

Finally, if it is a docx, you could avoid the tmp file, by inserting a Flat OPC version into a new Word using InsertXML. This is a bit more complicated (since you have to make the Flat OPC XML, though there is code for this in an MSDN blog post somewhere), but if you find yourself using InsertXML for other reasons, this might be attractive.



来源:https://stackoverflow.com/questions/3737728/open-word-document-from-database-or-webservice

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!