The version after Office XP supports direct editing of files on the server through the WebDAV protocol (HTTP extensions).
IIS (6.0) supports WebDAV, which is visible in the Web service extensions of IIS Manager. With IIS as the server side of WebDAV, you can easily implement online editing of office (Word,excel, etc.).
Can be simple to experiment:
Make sure that the WebDAV extensions for IIS are installed and enabled, set up a virtual directory test, place a Word document A.doc in it, and then open Word, and the file-> open-> Enter the access URL (http://localhost/test/a.doc) for the Word document.
Modify the contents of the document, save it, what happened? The document was saved to the server.
In IE, you can create word.application through JS to open, modify the document on the server.
Copy Code code as follows:
Wapp = new ActiveXObject ("word.application.11");
Wapp.visible = true;
WApp.Documents.Open (URL);
if (trackrevisions) {//can achieve trace reservation
WApp.ActiveDocument.TrackRevisions = true;
WApp.ActiveDocument.ShowRevisions = false;
}else
{
WApp.ActiveDocument.TrackRevisions = false;
WApp.ActiveDocument.ShowRevisions = false;
}
Wapp.activedocument.application.username= Global_currentusername;
Also, when you install Office, you press an ActiveX component: Sharepoint.opendocuments, can you use this component to activate Word, edit the document on the server: var __opendocuments = null;
Copy Code code as follows:
function document_edit2 (URL)
{
if (__opendocuments = null) br>{
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"
//opend Ocobj.createnewdocument ("Http://www.abc.com/documents/sampleTemplate.dot", "http://www.abc.com/documents/");
var result = __opendocuments.editdocument (URL, "Word.Document");
if (result = = False)
{
Alert ("Cannot open document.");
}
}
As you can see, based on WebDAV support for IIS, you can easily edit an Office document online, but there is a problem: So the document is stored on the file system, in many of our systems,
The document is stored in the database, so how do you implement it???
I tried a lot and found the solution. It'll be in the next article.