Document Server FAQ:

Saving questions

Expand all

Collapse all

How to forcefully save the document to my storage when editing it?

Normally the final document version is compiled once all the users editing it close the document and the delay time (about 10 seconds) passes. But this behavior can be overriden. To do that the forcesave option is available.

There are several ways to initiate forced saving:

  • Sending the request to the document command service, using the forcesave value for the c parameter:

    1. {
    2. "c": "forcesave",
    3. "key": "Khirz6zTPdfd7",
    4. "userdata": "sample userdata"
    5. }
  • Enabling the editorConfig.customization.forcesave setting to true in the editor initialization configuration:

    1. var docEditor = new DocsAPI.DocEditor("placeholder", {
    2. "editorConfig": {
    3. "customization": {
    4. "forcesave": false,
    5. ...
    6. },
    7. ...
    8. },
    9. ...
    10. });
  • Enabling the repeating forcesave start in the default.json Document Server configuration file:

    1. {
    2. "services": {
    3. "CoAuthoring": {
    4. "autoAssembly": {
    5. "enable": true,
    6. "interval": "5m"
    7. }
    8. }
    9. }
    10. }

Depending on which type of forced saving you need, you can select the correct implementation. More information about this can be found at this page.

How to save the created document?

Please see the Saving file section to find out how file saving works in Document Server and what is needed to save the created document.

How to save the opened document to another document file type?

If the document of a format different from the OOXML (.txt or .ods) is opened, the OOXML format will be saved by default.

To save the opened document to a format different from the default Office Open XML one, the POST request must be sent to the document conversion service.

The details of how the conversion works and why it is needed can be found in this section. The POST request parameters and available responses to it can be found here.

How to enable or disable the ‘Autosave’ option?

The Autosave option is enabled by default. To disable it, you need to set the editorConfig.customization.autosave parameter in the document configuration to false:

  1. var docEditor = new DocsAPI.DocEditor("placeholder", {
  2. "editorConfig": {
  3. "customization": {
  4. "autosave": false,
  5. ...
  6. },
  7. ...
  8. },
  9. ...
  10. });

Please note, that disabling the Autosave will also disable the Fast co-editing mode which only works with the automatic document saving enabled.

Further information about the autosaving can be found at this page.

What is the conversion start delay time and how can it be changed?

Normally the document is not physically saved to the computer hard disk drive in the compiled form when it is being edited. Once the editing is done and all the users who work on the document close it, the file is converted to the Office Open XML format and saved to disk.

After that the document editing service informs the document storage service that the file is ready and can be downloaded.

The time between the end of the editing and the conversion start is set in the default.json configuration file with the services.CoAuthoring.server.savetimeoutdelay parameter (5000 milliseconds or 5 seconds by default) and can be changed:

  1. {
  2. "services": {
  3. "CoAuthoring": {
  4. "server": {
  5. "savetimeoutdelay": 5000
  6. }
  7. }
  8. }
  9. }

Further information about the conversion start delay can be found at this page.

How to specify the encoding type when converting from the csv or txt formats?

To preserve the readability of a txt or csv file, you might need to set the encoding it was initially saved with. This might be useful in case the characters different from the base latin letters (umlauted letters like ä, ö, ü, letters with accents, cyrillic letters and so on) are used in the file.

For this purpose the POST request with the parameters set in the request body is sent to the document conversion service:

  1. {
  2. "codePage": 65001,
  3. "filetype": "txt",
  4. "key": "Khirz6zTPdfd7",
  5. "outputtype": "docx",
  6. "title": "Example Document Title.docx",
  7. "url": "https://example.com/url-to-example-document.txt"
  8. }

Further information about using the codepage during conversion can be found at this page.