DEV Community

Cover image for ONLYOFFICE updates for developers: API & Doc Builder [March 2023]
Kseniya Fedoruk for ONLYOFFICE

Posted on

ONLYOFFICE updates for developers: API & Doc Builder [March 2023]

Explore the updated ONLYOFFICE API for the editors, plugins, and Document Builder.

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>
Enter fullscreen mode Exit fullscreen mode

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, 
 ...
    },
 ...
});
Enter fullscreen mode Exit fullscreen mode

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"
}]);
Enter fullscreen mode Exit fullscreen mode

Get the latest version of ONLYOFFICE Docs Developer Edition

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:

  • ApiBlockLvlSdt/AddComment
  • ApiComment/GetAutorName
  • ApiDocument/AddTableOfContents
  • ApiDocument/AddTableOfFigures
  • ApiParagraph/AddCaption
  • ApiDocument/GetStatistics

Check the full list of new methods.

Download Document Builder

Useful links

What’s new in ONLYOFFICE Docs 7.3

ONLYOFFICE Docs 7.3.3 with the vulnerability fix

Updated Helm for ONLYOFFICE Docs

API documentation

API changelog

Plugins & macros changelog

DocBuilder changelog

Top comments (0)