Document Server FAQ:
Expand all
Collapse all
Which methods can be used when working with the document history events?
The document history can be shown using the onRequestHistory function (with the events.onRequestHistory event). Unless you use them, the Version History menu option (Version History button in the Collaboration tab) is not shown in the Document Server interface.
Once you call this function in the configuration file (together with the method), the menu option and button are shown and the program will display the existing document versions. The data which is shown in the document version history, can be taken from the document editing service callback.
So the implementation of the document version history display should look like this:
The callback handler parses the received data and passes it to the configuration file (it does not need to parse the history.serverVersion and history.changes data which can be used by the onRequestHistory function as is).
The configuration file must have the following sections present: events.onRequestHistory and the onRequestHistory function itself:
Where
- history is the array of objects, each representing a document saved single version:
- history.changes and history.serverVersion is the data received from the document editing service;
- history.user.id is the ID of the user who was the last to save changes to the document for the specified version;
- history.version is the number of the specified version as will be displayed in the version history section of the document editor interface.
- history is the array of objects, each representing a document saved single version:
- The document is opened with all the above parameters specified. Switch to the File > Version History menu option (or Collaboration > Version History) and there the version data will be displayed.
The history.changes objects are displayed as smaller changes (revisions) within the versions.
How to display a document with highlighted changes?
The document editing service saves all the interim changes of the document into separate files and, once the version is compiled and status 2 is received, the link to the archive with all the changes between the versions is also sent to the callback handler.
In addition to the actions described in the you will need to:
Parse the changesurl parameter from the document editing service received response with status 2:
Why is a new version not shown in the document history after I forcefully save a document?
ONLYOFFICE Docs highlights the changes made from the beginning of the current document session, not from the beginning of the document version. And even if several document versions are created during one session, all changes from this session will be highlighted. Therefore, you cannot see the document versions created with the force saving option in the document history.