ONLYOFFICE Docs 7.3 for developers: API & Doc Builder updates

Originally published at: https://www.onlyoffice.com/blog/2023/02/onlyoffice-docs-7-3-for-developers/

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

ONLYOFFICE Docs 7.3 for developers: API & Doc Builder updates

Enhanced WOPI support

From now on, you are able to work with the binary formats such as doc, ppt, and xls within WOPI integrations. We implemented the corresponding scheme which includes the convert action in the WOPI discovery. It converts binary files into docx, pptx, and xlsx for further editing.

Besides, we added the WOPI Conversion API for easier work with different office file formats.

<form action="https://documentserver/cool/convert-to/docx" enctype="multipart/form-data" method="post">     
File: <input type="file" name="data"><br/>     
<input type="submit" value="Convert to DOCX">
</form>

Further enhancements here comprise:

  • UserCanNotWriteRelative property in the CheckFileInfo WOPI operation which specifies if a user has permissions to create new files on the WOPI server or not;
  • PutRelativeFile WOPI operation which creates a new file on the host based on the current file.

Inserting external data in spreadsheets

The newly added document.referenceData parameter defines an object that is generated by the integrator to uniquely identify a file in its system.

Together with the implemented setReferenceData method and onRequestReferenceData event, it is now possible to refresh data using a link to a file — when a user is trying to update values inserted from the external file by clicking the corresponding button in the External links dialog box. Learn more

var onRequestReferenceData = function () {
var referenceData =  event.data.referenceData;
var path = event.data.path;
   ...
docEditor.setReferenceData({
 "fileType": "xlsx",
 "path": "sample.xlsx",
 "referenceData": {
"fileKey": "BCFA2CED",
"instanceId": "https://example.com"
 },
 "url": "https://example.com/url-to-example-document.xlsx"
 });
};
var docEditor = new DocsAPI.DocEditor("placeholder", {
"events": {
"onRequestReferenceData": onRequestReferenceData, 
 ...
    },
 ...
});

Interface customization

Users of ONLYOFFICE Docs Developer Edition with the extended license get new options for customizing the frontend of the editors via the config file:

  • adjusting the font of the interface elements such as buttons, tabs, etc.;
  • defining the initial value of the right/left panel visibility – displayed or hidden.

API updates for plugins and macros

Check this code example for the OnDropEvent method:

window.Asc.plugin.executeMethod("OnDropEvent", [{
  type: "ondrop",
  x : pos.x,
  y : pos.y,
  text : "test text",
  html : "test html"
}]);

Get the latest version of ONLYOFFICE Docs Developer Edition:

DOWNLOAD NOW

API updates for Document Builder

In the DocBuilder API, we added lots of new comment, table of contents/figure, and some other methods, including the following ones:

Check the full list of new methods.

Please note: for now, the updated DocBuilder API is already available. Installation files for ONLYOFFICE Document Builder will be updated to v7.3 soon.

Useful links

What’s new in ONLYOFFICE Docs 7.3: blog / video / live event

ONLYOFFICE for developers

ONLYOFFICE Document Builder

API documentation

API changelog

Plugins & macros changelog

DocBuilder changelog