ONLYOFFICE Docs 7.5 for developers: API and Doc Builder updates

23 October 2023By Ksenija

Along with the release of the new features in version 7.5, we updated API for the editors, Document Builder, plugins, and desktop app. Check all the details below.

ONLYOFFICE Docs 7.5 for developers: API and Doc Builder updates

API for working with forms

Hide/show the Submit form button. Using the editorConfig.customization.submitForm parameter, it’s possible to define if the Submit button is displayed or hidden on the top toolbar for OFORM files.

var docEditor = new DocsAPI.DocEditor("placeholder", {     
"editorConfig": {         
"customization": {
...
"submitForm": true,

Further parameter for Force Save. In version 7.5, we added the 3 type for the forcesavetype parameter of the callback handler. If applied, the force saving request is performed each time the form is submitted, e.g. when the Submit button is clicked.

{    
 "changesurl": "https://documentserver/url-to-changes.zip",     
"forcesavetype": 3,
....

API for working with documents

Changing a source of the external data. The newly added events.onRequestReferenceSource event is called when a user is trying to change a source of the external data by clicking the Change source button in the editors. An object with the unique file data and the file path or name are sent in the data parameter.

When the button is clicked, you must call the setReferenceSource method to change a source of the external data. When calling this method, the token must be added to validate the parameters. If the event is not declared, the Change source button will not be displayed.

var onRequestReferenceSource = function () 
{     var referenceData =  event.data.referenceData;     
var path = event.data.path; 
...
    docEditor.setReferenceSource({        
"fileType": "xlsx",         
"path": "sample.xlsx",         
"referenceData": {             
"fileKey": "BCFA2CED",             
"instanceId": "https://example.com",             
"key": "Khirz6zTPdfd7"        
},

Key field. The key field added to the document.referenceData parameter defines the unique document identifier used by the service to take the data from the co-editing session.

In case the known key is sent, the document will be taken from the cache. Every time the document is edited and saved, the key must be generated anew.

The document URL can be used as the key but without the special characters and the length is limited to 128 symbols.

var docEditor = new DocsAPI.DocEditor("placeholder", {     
"document": {         
"fileType": "docx",         
"key": "Khirz6zTPdfd7",         
"referenceData": {             
"fileKey": "BCFA2CED",             
"instanceId": "https://example.com",             
"key": "Khirz6zTPdfd7"        
},

Conversion API

Conversion API is extended with the -9 error code which occurs when the converter cannot automatically determine the output file format.

This error means that the client must explicitly specify in which format the file should be converted – text document or spreadsheet. It is used to convert XML to OOXML in case the XML type is unknown.

{     
"error": -9 
}

Other updates

Besides, in the desktop app API, we added the uiTheme parameter to the portal:login command which defines the editor theme settings when connecting the desktop editors to the cloud.

Get the latest version of ONLYOFFICE Docs Developer Edition:

DOWNLOAD NOW

API enhancement for plugins

The newly added align parameter of the ShowButton method indicates whether the button will be displayed on the right side of the window or on the left. The default value is “left”.

window.Asc.plugin.executeMethod ("ShowButton", ["back", false, "right"]);

API updates for Document Builder

In the DocBuilder API, we added multiple new watermark and Combo Box & Drop-down list Content Control methods, several global and slide methods, including the following ones:

Check the full list of new methods.

DOWNLOAD BUILDER