The reference figure and the steps below explain the process of saving a document in ONLYOFFICE Docs.
new DocsAPI.DocEditor("placeholder", { "document": { "fileType": "docx", "key": "Khirz6zTPdfd7", "title": "Example Document Title.docx", "url": "https://example.com/url-to-example-document.docx" }, "documentType": "word", "editorConfig": { "callbackUrl": "https://example.com/url-to-callback.ashx" }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2N1bWVudCI6eyJmaWxlVHlwZSI6ImRvY3giLCJrZXkiOiJLaGlyejZ6VFBkZmQ3IiwidGl0bGUiOiJFeGFtcGxlIERvY3VtZW50IFRpdGxlLmRvY3giLCJ1cmwiOiJodHRwczovL2V4YW1wbGUuY29tL3VybC10by1leGFtcGxlLWRvY3VtZW50LmRvY3gifSwiZG9jdW1lbnRUeXBlIjoid29yZCIsImVkaXRvckNvbmZpZyI6eyJjYWxsYmFja1VybCI6Imh0dHBzOi8vZXhhbXBsZS5jb20vdXJsLXRvLWNhbGxiYWNrLmFzaHgifX0.vbezS2aM8Xf8qFzIAsO-jrIsi7VLxjRYkIkwh5jLTJU" });Where example.com is the name of the server where document manager and document storage service are installed.
Once the document editing is finished, the document editing service informs the document storage service about it. The time before this is done is calculated using the conversion time of the edited file into the Office Open XML format (which depends on the file size, complexity and the computer power, and can be performed rather a long time), and conversion start delay time (which is equal to 5 seconds by default). In most common cases the time is about 10 seconds after the editing is finished.
The conversion start delay is necessary to allow to return to the file editing session without the file saving, e.g. when reloading the browser page with the file opened for editing. The default conversion start delay time is defined with the services.CoAuthoring.server.savetimeoutdelay parameter in ONLYOFFICE Docs configuration file, which can be found at the following path:
If you want to change it, you can use the local.json file, where all the edited parameters should be stored. This file is located in the same directory as the default.json file and the whole object structure for the necessary parameter must be retained (see the examples below).
Parameter | Description | Type | Example |
services.CoAuthoring.server.savetimeoutdelay | Defines the conversion start delay time (measured in milliseconds) after the edited file is closed. | integer | 5000 |
{ "services": { "CoAuthoring": { "server": { "savetimeoutdelay": 5000 } } } }
Document editing service allows to get the current document state before the editing is finished. The process is called forcesave in ONLYOFFICE Docs. When forcesave is initiated, document editing service performs request to the callback handler with the link to the document as the url parameter and with the 6 value for the status parameter. The forcesave process can be initiated the following ways:
Parameter | Description | Type | Example |
services.CoAuthoring.autoAssembly.enable | Defines if the automatic forcesaving is enabled or not. The default value is false. | boolean | false |
services.CoAuthoring.autoAssembly.interval | Defines the interval time in minutes for initiating the automatic forcesaving. | string | 5m |
{ "services": { "CoAuthoring": { "autoAssembly": { "enable": true, "interval": "5m" } } } }The forcesavetype parameter will have the 2 value when sending the request to the callback handler.
Starting from version 7.0, the assemblyFormatAsOrigin server setting is enabled by default to save the assembled file in its original format. It is used to change the file format from OOXML to ODF or to save files with macros.
Parameter | Description | Type | Example |
services.CoAuthoring.server.assemblyFormatAsOrigin | Defines if the assembled file is saved in its original format or not. The default value is true. | boolean | true |
{ "services": { "CoAuthoring": { "server": { "assemblyFormatAsOrigin": true } } } }