Comparing documents
The reference figure and the steps below explain the process of comparing documents in ONLYOFFICE Document Server.
- The user opens the document for viewing or editing using the document manager (found in his/her browser).
- The document storage service sends the document information using the JavaScript API to the document editor and specifies the possibility to choose the file from the document manager.
- The file is opened for editing.
- The user sends a request to get a list of storage documents for comparing by clicking the Document from Storage button in the document editor.
- The document editor informs the document manager about the request.
- The document manager sends the document to the document editor for comparing.
How this can be done in practice
- Create an html file to Open the document.
Specify the event handler for the Document from Storage button to be displayed in the Compare options in the configuration script for Document Editor initialization. When the user clicks the button, the onRequestCompareFile event is called and they can select the document for comparing from the Storage.
var onRequestCompareFile = function() {
docEditor.setRevisedFile({
"fileType": "docx",
"url": "https://example.com/url-to-example-document.docx"
});
};
var docEditor = new DocsAPI.DocEditor("placeholder", {
"events": {
"onRequestCompareFile": onRequestCompareFile,
...
},
...
});
In order to select a document for comparing, the setRevisedFile method must be called:
docEditor.setRevisedFile({
"fileType": "docx",
"url": "https://example.com/url-to-example-document.docx"
});
After that the user can accept or reject the changes using the corresponding buttons on the top toolbar.
当前内容版权归 Onlyoffice 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Onlyoffice .