Versions later than Office XP support direct editing of files on the server through WebDAV protocol (HTTP extension.
IIS (6.0) supports WebDAV, which can be seen in the Web service extension of IIS manager. using IIS as the WebDAV server, you can easily edit office (Word, Excel, etc.) online.
You can perform a simple experiment:
Ensure that iis's webdavy is installed and enabled, create a virtual directory test, put a wordfile a.doc in it, then open the word, file-> open-> enter the access URL of the Word file (http: // localhost/test/a.doc ),
Modify the document content and save it. What happened? The document is saved to the server.
In IE, you can use js to create Word. Application to open and modify documents on the server.
CopyCode The Code is as follows: wapp = new activexobject ("word. application.11 ");
Wapp. Visible = true;
Wapp. Documents. Open (URL );
If (trackrevisions) {// can trace retention be achieved?
Wapp. activedocument. trackrevisions = true;
Wapp. activedocument. showrevisions = false;
} Else
{
Wapp. activedocument. trackrevisions = false;
Wapp. activedocument. showrevisions = false;
}
Wapp. activedocument. application. Username = global_currentusername;
In addition, an ActiveX component: Sharepoint. opendocuments is installed at the same time. Can this component be used to activate word and edit the document on the server: VaR _ opendocuments = NULL; Copy code The Code is as follows: function document_edit2 (URL)
{
If (_ opendocuments = NULL)
{
Try {
_ Opendocuments = new activexobject ("Sharepoint. opendocuments.3"); // For Office 2007
} Catch (e ){}
If (_ opendocuments = NULL | typeof (_ opendocuments) = "# ff0000 ")
{
Try {
_ Opendocuments = new activexobject ("Sharepoint. opendocuments.2"); // For Office 2003
} Catch (e ){}
}
If (_ opendocuments = NULL | typeof (_ opendocuments) = "undefined ")
{
Alert ("Please install word (2003 or later )");
Return;
}
}
// Opendocobj. viewdocument ("http://www.abc.com/documents/sample.doc");, "word. Document"
// Opendocobj. createnewdocument ("http://www.abc.com/documents/sampleTemplate.dot", "http://www.abc.com/documents ");
VaR result = _ opendocuments. editdocument (URL, "word. Document ");
If (result = false)
{
Alert ("unable to open document .");
}
}
We can see that IIS-based WebDAV supports online editing of office documents, but there is a problem: in this way, documents are stored in the file system, in many of our systems,
The document is stored in the database. How can this problem be achieved ???
I tried a lot and found the solution. It will be in the next article.